Most probably it is a pin worm and its female . It can lay 24 million worms in one day. These usually live in the colon of the horse and produce itching near the anus. For further assistance please visit this link.
Seeing worms in your horse's stool is an indication that there are (more than likely) lots more in it's digestives system and possibly in it's arteries. Having known of horses that have died from a strong initial deforming, caused by the worms dieing and clogging arteries I would suggest a slow consistent process like a 5 day Panache / Safeguard program to start with, but you may be wise if you don't know to consult a professional in your area.