Can't say whether or not it's some sort of intestinal worm, but if you suspect that your cat has worms, I have a fairly easy, quick, cheap solution.
We had kittens once, long ago. They all got worms, pretty badly. Roomate "trained" the kittens to take food from plates. Often, very agressivley...
To curb this, we started eating hot sauce, Lots of it. Dave's Instanity Sauce. Some of the kittens developed a taste for it.
The worms, however, did not.
Worms were scrambling to get out about as fast as they could.
"Run away! Flee!"
Imagine spaghetti noodles being pressed to shape through the die...