Roundworms probably evolved into segmented worms, or annelids, probably about 545 million years ago. The earliest annelids all lived in the ocean, as most kinds of annelid still do today. Some annelids live inside of sponges. Their long bodies were shaped like a hollow tube, with a long tunnel running down the middle of their bodies. At one end was the mouth, and at the other end the anus, where the poop came out. Some annelids have stomachs, in the middle of the long digestive tube.
Earthworms: are they always helpers?
The big difference between roundworms and segmented worms is that segmented worms have a real circulatory system with blood. Many segmented worms also have less developed eyes than roundworms - these segmented worms only have eyespots, like flatworms. But other segmented worms do have more developed eyes.
By about 510 million years ago, some of these segmented worms were already evolving into fish. But many of them stayed segmented worms, and there are still lots of segmented worms all over the Earth today, on land and especially in the water.
To find out more about worms and leeches, check out these books and worm kits from Amazon or from your library: