If the worms are an I shape and white, then they are detritus worms.
If the worms are white and have an arrow shaped head they are planaria.
These worms normally live in the substrate or plants and only crawl on the glass when something is not right with the tank.
Do a 75% water change and gravel clean the substrate every day for a week. The worms should go back into the gravel when it is clean.
*NB* Make sure any new water is free of chlorine/ chloramine before it's added to the tank.
------------------------
You don't mention a filter. Do you have a filter on the tank?
If you don't have a filter, you need to get one.
If you don't have a filter, you should only feed the fish a couple of times a week and do a 75% water change and gravel clean the substrate 4-8 hours after feeding.
You should also get an ammonia and nitrite test kit and monitor the ammonia and nitrite levels. If you get any ammonia or nitrite readings, do a 75% water change and gravel clean the substrate.