I forgot what they are called....I believe that they would be harmless if fish ate them. In extreme cases, the worms can latch onto the scales of fish.
While the worms themselves can be harmless, the presence of these worms is likely due to poor water quality such as extremely high nitrates.
A little disclaimer here, I wrote this without doing any research. I believe what I have written is accurate. My water quality has not suffered in a long time. Worms are not something I've experienced.