Worms eat uncomposted vegatable matter, of which (hopefully) there should be NONE of in your soil.
They will starve to death, which is probably why one of them was trying to escape.
Worm shit (castings) is an excellent amendment inside or out, and worms in outdoor soil means the soil is healthy, but inside it's a no go.