A sandy car is not a good time. One great way to get sand out of car carpets is to use a horse-hair brush.
Horse hair is really coarse, so it can lift grains of sand out of your carpet much more easily than other tools. Once you’ve lifted the sand to the surface, go over the sandy areas with a microfiber cloth or dryer sheet to pick up the sand (as well as any fur, dust, or hair that your carpet may have accumulated). You can also use the brush on other parts of your car, like your seats.