Planaria? Should not be toxic. Snails, worms, and gammarus help in breaking down uneaten and rotting vegetation to molecular level that plant roots take up. Ammonia could be in substrate air pockets.
1) If you have a heavily planted tank just use a plastic fork to poke holes in substrate. Do so only if you have additional circulation and airstone, or tape it to gravel vac right before a water change.
2) Gravel vacuum only if you see detritus free floating in water.
3) Try reducing feeding amount and frequency.
4) What plants, fish? What are you feeding?