worm come from uneaten food. meaning that there is left over food in your tank for a long time, or you never take the uneaten food out.
Every time you feed piranha all uneaten food have to take it out after 30min. if you leave it to long in the tank, it will mess up the water parameter.
Also it sound like you didn't do enough water and vacuum the gravel well.
Here what you can do, for a couple of week. Do 30-50% of water change and vacuum the gravel ever 3 days. Raise up the temp. Check the filter as well, worm maybe in there. clean the filter out.
When you clean the filter out, DON'T clean it with tape water. clean with water in the tank. so that way it won't kill the bacteria in the filter.