The worms look like an aquatic worm that lives in the substrate. They are normally harmless and feed on rotting organic matter in the substrate. However, if the water quality deteriorates, the worms will leave the gravel and try to find a new place to live. Seeing the worms on the surface would suggest something is wrong with the tank.
Do a 75% water change and gravel clean the substrate every day for 2 weeks. Make sure any new water is free of chlorine/ chloramine before it's added to the tank.
Clean the filter if it hasn't been done in the last 2 weeks. Wash filter media in a bucket of tank water and re-use it. However, if the filter is less than 6 weeks old, do not clean it unless it is really dirty and the flow rate has been reduced. Washing out a new filter can interfere with the filter bacteria developing in it.
-----------------------
The fry disappearing/ dying is either from poor water quality, starvation or predation form other fishes in the tank.
What other fish are in the tank?
What were you feeding the babies?
How often were you feeding the babies?