There is nothing wrong with the .40 s&w. It is a viable cartridge, and still in wide spread use. During the plandemic, .40 s&w was in fact much cheaper than 9mm....9mm was close to 1$ per round, while .40 stayed at about .38$ per round. It has plenty of power, and as compared to 45ACP, magazine capacity is good.
If the gun is, and has been reliable, and you have no issues with controlling the gun and being accurate enough at combat/defensive ranges of 25yards to danger close, I see no reason to change calibers. You will not be gaining much
With that being said. I find that the 9mm platform, is most suitable for the lion's share of people, in regards to ammunition capacity, power, and recoil.
In the past 30 years, many gun manufacturers have made polymer striker fired 9mm pistols, that are in many ways "better" than the Glock. For you, that should also be a consideration. Does the gun fit well, do you really like it? And so on.
I would suggest selling the gun to someone you know, should you decide to sell it, as you will get more money than a dealer would give of course.
One very good pistol in 9mm that is very "cheap" is the XD9 Service model, can be had for under $400 bucks these days, the price mostly being because of SA's unpopular connection with an anti gun law in IL about 8 years ago.........but the gun is solid.
another would be the XD, and maybe the Echelon, but I do not have one of those,
@Astro14 has a good write up in his new gat.
That all I got, good luck.....and should you want to donate your 40, Ill pay shipping no problem.