Finding earthworms on my carpet

For some time now I’ve found the occasional earthworm on my carpeted basement floor. They’re dried out when I find them, but I assume they were moist and wiggly when they arrived. Why do they keep showing up?
It’s a fully furnished basement, very clean, vacuumed regularly and so forth. I get the occasional bug making its way in from outside, but it’s not a lot. I don’t get the usual bugs you might associate with an unfinished, damp basement. I have two small dogs, but I don’t think they’re bringing in an earthworm and dropping it in the basement.
I speculated for a while that I was tracking them in on my shoes when it’s rainy outside and the worms are on the surface. But I’ve paid more attention and they appear even during long dry spells.
Any ideas?

I’d blame the dogs.

Are are they coming in through a window?

If you have sump pumps, check the whole system, from the sump to the end of the waste line. It’s possible to have a crack where they’re getting in.