Have Pet Questions? Get Answers from Experts Now.
I'd suggest finding a local pest removal service and have them take a look at the worms you are seeing. These might be caterpillars of some sort and be a part of the life stage of an insect rather than being a parasite of your pets.
You can look at dog and cat parasites here
to compare with what you have seen.
If you are seeing any house moths for example or beetles in the house the 'worms' may be larval stages of those insects.
If you have brought in any new houseplants something could have come in with them too.
Hope this helps you!