I'm hard pressed to see commonality.
Heinlein's aliens are secretive infiltrators who sneakily turn people into traitors, and the heroes have to guess who is infected and who is not. The Trek parasites just rush in openly and subdue the populance with pain, and there is no doubt who is infected and who is not. Heinlein's monsters are stirred to action by a visit from an Earth exploration vessel, in essence making humans guilty of their own suffering, while the Trek ones seem to spread on their own, without requiring the thoughtlessness of humans.
Heinlein's heroes' opponents are "recruited" people and their traitorous activities; Kirk's opponents are the creatures themselves. Heinlein's heroes try to cope amidst a hostile society, while Kirk serenely hovers over it during the search for a cure.
The basic idea of parasitic aliens is common to the two stories, but it's certainly much older than Heinlein's book. And specifically the approach where the parasites are beastly monsters to be medically removed, rather than an intelligent foe with aims and goals, is the good old version that predates the fifties.
Timo Saloniemi