Vacuum the worms you find and cut back on feeding. That's really the only way to get rid of them. Don't resort to chemicals. For pests that don't harm your fish, chemicals will make matters worse.
i had those in my pirhanas did large water changes added lil salt but make sure its aquarium salt dont use dossage they require use smaller dose and aged filtered water