Planaria are not white, they're very dark in color. They're short, fat, and have a triangular shaped head. The only way you can get these into your tank is by adding plants that you did not dip or quarantine first. Planaria are carnivors and fish will not eat them. If you have them in your tank you will have to add medication to kill them.
Detritus worms are light in color, skinny, long, and you cannot tell the head from the tail. These little worms are in every healthy tank and are part of the little echo system in there. Think of them as trash compactors... they eat uneaten food and live under the substrate.
If you see drtritus worms above the substrate this means you have not kept the substrate clean (gravel vacs keep their population numbers down). What happens is they run out of oxygen because there's too much gunk, so they rise to the surface of the substrate so they can get more oxygen. This can be dangerous because they'll use up too much of the oxygen in the water column. This is bad for the nitryfing bacteria and can be dangerous to fish who use oxygen from the water column.
Do not add any medication to the tank to kill detritus worms. Do gravel vacs to bring down their population. You don't want to remove them all, just the majority of them. It's perfectly fine if your fish eat them.