My guess is that it came from the output hose of your filter, assuming you turned off your filter when performing a water change...happens to me. To avoid this, I run the filter with the output into a bucket just long enough to flush out the debris.
If they are moving around - they look like the little worms I would get when I overfed my tank and then stir up the gravel - I don't really see that now, more in my younger days