We can never be sure without seeing the eggs under a microscope. But here is my thinking:
Assuming it is a parasite and not a string of mucus, it is either tapeworm, roundworm or fluke. I cannot see segments which would be visible on a tapeworm. Most flukes are fat and flat, so I don't think it is a fluke. Given that it looks like a roundworm I would say that is great place to start treatment.
Ivermectin is a great broad spectrum antiphrastic, it is very well tolerated with very few side effects even at 10x the dosage. The scientist who discovered Ivermectin actually received a Nobel prize a couple years ago. A very interesting medication.
If you search the forum for ICU, she has some very detailed protocols for each type of worm.
There are blood test that attempt to diagnosis specific parasites infections, but most are not perfectly accurate. The best test is microscopic stool analysis, but usually needs to be repeated several times to be successful.