I would definitely start by cleaning him and checking for a bean. If you don't have experience doing that, ask your vet or an experienced horse person to help you.
My guy started swelling just a tad in the sheath area, and he had also been walking stiffly (which I was scared was his hoof trim or arthritis) but anyway, after cleaning him and getting out lots and lots of smegma (dirty, greasy goobers, lol) now he walks much better, pees right away (on rides he used to stop and try to pee 2-3 times before he actually peed) and the swelling disappeared after a few days after cleaning him.
I feel like I have my horse back, because he even rides better!
And it's not like he was never cleaned, I cleaned him earlier this spring. But I guess a few months can make a big difference. He didn't even have a bean this time around, he just had lots and lots of smegma, which can get rough and dry around the opening of the sheath, and that is what was irritating him.