Do you heat treat the substrate before using it? did you take a picture of the "worm" an google it? Google would tell you what it is. Or bag one an drop it off at the Vet.
Did the snake poop in the bowl?
Without seeing it I have zero clue. The safe thing to do is clean an make a Vet appointment. The Vet will need a stool sample for a float test.
Good luck!