That looks like a common earthworm, and is unlikely to be dangerous to your plant. However it likely won’t get a great amount of nutrients inside, so you should probably let it outside in your garden. If you’re really concerned about pests (not worms specifically) or keeping pets away from your plants citrus rinds and diluted vinegar are good deterrents and safe for plants. You can either put the citrus in with the vinegar (2 tbsp per 2 c of water sprayed on plant) or put the citrus rinds in the pot.