First of.... YUCK!!!
if that were me, first I'd probably go throw up... I personally wouldn't be pulling anything out. Not to say that's not the right thing to do, i just don't think I could!
I would take a stool sample in first thing and probably describe it to the vet as well. I imagine its just worms and nothing to worry about.