Flatworms, roundworms and segmented worms are actually examples of three very different species of worm, with the only major similarity between all three being that they are all classified as worms. Some species do share similar traits, however; roundworms and flatworms both have a body cavity for example as well as a complete digestive system.
Flatworms are in many ways the most simplistic of the three species, in that the digestive tract is incomplete, and there is no internal body cavity. Flatworms do possess the ability to regenerate, however, meaning that if one is cut in half, both sections will grow a new head and tail respectively. The tapeworm is an example of a flatworm.
Roundworms tend to be more developed than flatworms, in that they have a complete digestive tract, although the internal cavity is devoid of mesoderm. Roundworms are very common, and it is estimated that there are as many as 500,000 different species of them in the world. The heartworm is just one of many examples of a roundworm.
Segmented worms are probably the most well-known, as the earthworm falls into this category. They also tend to be the most advanced of the three species, in that they have fully developed digestive tracts, as well as setae, which are small hairs that help the worm to move by grappling on surrounding terrain.