Cindy, those look to be bristleworms. They are not bad as people think, BUT too many of them can look too unsightly, they are pretty ugly.
As for flatworms, here is a pic
You do not want those brown flatworms. They are easy to kill if you spot a few, but if you have too many, when they die, they let out a poison that can wipe out your tank.
Not very many things eat it though mandarin gobies have been known to eat them especially the psychadelic mandarin.
There is a type of nudibranch that eats it but its hard to get. Then there is a chemical called Flatworm Exit that can kill them.
If you have these, don't bring sand or macro algae. Let me know if you have them, I can help you out.
Best way to avoid these things is to look at corals you are buying and if there are the brown flatworms, avoid buying the coral, it will save you a lot of headache!