Volume of sand in a cat box - ultrasonic sensor?
If you're trying to setup some sort of auto-refill or alerts based on litter box levels I would rather look into a system based on weight measurement setup to determine amount of litter present instead.

Although this would need to be adjusted for different brands of litter.