Do they look like this?
If so, they are planaria worms. “Here”: is what AquariumFish.net says and how to get rid of them:
“1. Clean Your Aquarium. Click here to read about Cleaning Your Warm Water Aquarium. In particular you should clean your gravel with a Gravel Washer. Click here for more about a Gravel Washer.
2. Add Aquarium Salt to your aquarium up to a maximum of 1 Tablespoon for each 5 gallons of water in your aquarium. I seem to remember you have a so-called 29-gallon aquarium, which probably has about 25 gallons of water. If so, you should add a maximum of 5 Tablespoons of Aquarium Salt. If, for example, you already have 2 Tablespoons in your water, add 3 more Tablespoons.
3. Don’t Over React. Clean your gravel every day with the Gravel Washer. When you’ve removed 20% of the water, stop and top your aquarium back up with tap water from the faucet. In your case 20% of 25 gallons = 0.20×25 = 5 gallons. Repeat this procedure every day.
4. It may take several days of gravel washing to get your gravel really clean. When it is finally really clean, begin removing gravel, until it is at most 1/4” deep. If you have an under gravel filter, email me back, because you’ll need some more advice, or click here to go to another website with information about how to remove an under gravel filter.
5. Add Quick Cure. Each day after you clean your aquarium and wash the gravel, treat the water with 1 drop of Quick Cure for each gallon of water in your aquarium. In your case this will be 25 drops once a day each day. Click here for more about Quick Cure. You can also replace the Aquarium Salt that you removed, which would be 1 Tablespoon in the 5 gallons of water.
6. Small fish such as baby mollies might eat the planaria. I would try adding a few small fish to see if they will eat the planaria.
Repeat steps 1 to 6 listed above, until you don’t see the worms any more. This procedure will take several days and require quite a bit of your elbow-grease, but it’s the safest method for the rest of the fish in your aquarium. ”