Hi there - sorry for the delay in our reply. Sometimes the more complicated problems can be a bit more of a challenge to tackle.
If I understand correctly, your dog has a lump of some sort near his rectum that is causing him to scoot and spin on his bottom and is not going away with treatment with an antibiotic and an anti-inflammatory. The vet doesn't think it's related to his anal glands, but is also hesitant to remove it because of its location near the rectum. I hope I got all that right - please let me know if there's anything I missed.
If there is in fact a lump back there not associated with the anal glad, there is at least one thing that can be done non-invasively to get an idea what that lump is. A fine needle aspirate is a test where a small needle is used to gather a sample from the mass for microscopic examination. Sometimes this can give us an answer as to what the mass is and whether it can or should be removed.
Another option would be to ask your vet if referral to a board certified veterinary surgeon is an option. If I have a patient with a mass that needs to be removed but it's above my skill level, I refer them to a specialty hospital nearby where a surgeon with more experience can tackle the problem.
Scooting and spinning on the bottom can sometimes be a symptom of allergy itching and resolve with steroid treatment. I do often prescribe steroids to my patients who have itchy bottoms with quite good success. This would be another treatment option to discuss with your vet, although it doesn't address the lump that you've described.
I hope that this information was helpful - please let me know if I can answer any other questions for you:)