It is important to minimize the contamination of environmental soil with the feces of infected animals so as to reduce the exposure hazard to both humans and other animals. You may not know and this is one of the arguments in favor of regular deworming. Regular deworming is especially recommended for cats that hunt and might consume the flesh of hosts carrying worm larvae. Kittens are frequently simply assumed to be infected and automatically dewormed. Of course, there are ways to find out if your pet is infected.
Roundworms are long, white and described as looking like spaghetti.
Tapeworms can also be vomited up but these are flat and obviously segmented. If you are not sure what type of worm you are seeing, bring it to your vet's office for identification. Fecal testing for worm eggs is a must for kittens and a good idea for adult cats having their annual check up. Numerous deworming products are effective. Some are over the counter and some are prescription.