Alice, I don't think you should worry. These are probably Enchytraeid worms, which don't eat living plant tissue. Most live on dead plant material, some live on the funguses which grow on such material. They thrive in acid conditions, which may be quite likely with your compost.