Would of rather got to the bottom of the worm, usually anchor worm and lice like that attach themselves to the fish gills,body, or even fins, always best to no what you are dealing with,but if they were flicking and rubbing there is something nasty in the tank, have you added any new fish or live plants, as they can come in on them.
Not the writer of this information below.
Anchor Worm (a.k.a. Lernaea)
Symptoms:
Infected fish can be seen with whitish red worm-like threads, about ¼ inch long. Trailing at the rear of female parasites are two long, tube-like egg sacs. The parasites can be found anywhere on the body of the fish, including the eyes, gills and fins. Raised ulcers may appear at the site of attachment. Consequently, secondary bacterial infections may occur. The tale-tale sign that your fish is infected will be if you notice it rubbing or scraping against objects in the aquarium. It does this in an effort to remove the parasite.
Cause:
The parasitic crustacean Lernaea. Lernaea burrow into the muscle and gill tissue of fish, often times reaching as deeply as the internal organs, causing severe damage. Heavy infestations can cause significant weight loss and death.
Treatment:
You should kill all visible worms by dabbing them with a cotton swab, dipped in Potassium Permanganate or an anti-parasitic medication. Then you should carefully remove them from the fish with tweezers. You should kill the parasites before removing them because if they have burrowed deeply, removing them alive could cause the fish pain and significant physical damage. Once you’ve removed the parasite, you should then dab the wounds with Methylene Blue to prevent secondary bacterial infections from occurring. It is highly recommended that you feed the fish with medicated food. The tank will also need to be treated to kill any unseen, free-swimming juvenile parasites. You can use Fluke Tabs, Clout, Paragon or Trifon for this.