You must take your cat to the vet immediately in a case like this.
Issues with urination aren't trivial, and particularly in (older, neutered) males, can lead to death in a short period of time. If your cat is visiting the litter box but not producing anything, this is a sign of a urinary blockage. Inflammation or struvite crystals have blocked the urethra, preventing elimination. It takes only a couple of days for the toxins from the retained urine to build to a fatal level.
A case like this is critical in all cats; males are at a particular risk due to a longer urethra providing more chances of blockage. If the cat is still urinating in some cases (as mentioned in the question), they are likely not fully blocked yet, but immediate vet attention is still vital.
Your vet can insert a catheter to dislodge the blockage and release the urine; treatment may take longer than a single visit, as a cat who has blocked once can easily block again. After treatment, changes in diet will almost definitely be needed, to help prevent the issue from recurring, including a switch to (likely prescription) canned food, to encourage hydration to flush out future crystals before they reach a size that can cause a blockage.
The good news is that, with immediate vet attention, a cat can survive a blockage and lead a perfectly normal life afterward. My own cat lived another five years with no further blockages, and was quite happy to switch to a full wet diet.