I had a cat that would use the litter box and then suddenly stopped.
I took him to the vet, and he said before he did any costly test he wanted me to try something.
I had three cats at the time, and three litter boxes, my vet informed that some cats do not like share litter boxes with others. He told me to go get another litter box, put it in a "special spot" just for Wendell.
I had my doubt but I did exactly as he told me, of course I had to try and keep an eye on the other cats so they wouldn't go use Wendell's box and I was surprised, he started using his box again and has ever since