Oh my, I never realized earthworms could do damage. I'd probably remove the plants from their containers, relocate the soil with the earthworms to the garden and repot the plants in fresh potting medium. I occasionally find a couple of earthworms in my plants when I'm repotting and I just take them out to a flower bed, dig a little hole and place them in the hole and cover them up.