+1 to all the health things mentioned by PP.
Some of your story resonates with me as I was always underweight, then over the past 10 years started gaining weight, and any efforts to lose were very slow.
I realised a lot my problem was being much more sedentary every day: In my younger years I didn't own a car and used to walk 90minutes per day in my commute. Later I drove to work, and the shops, and even later started working from home. It turns out I hardly ever move.
Then consistent over-eating "small" amounts: I never used to snack or drink alcohol, but then started having 3 biscuits daily, a slice of cake on the weekend, and maybe a bottle of wine. Occasionally I would binge (e.g. eating a whole packet of biscuits) on junk food, but not everyday. Some days i would have a few pints in the week. Breakfast, lunch and dinner are healthy.
All of this added up. Even if I would try to work out for a month (e.g. doing weights 2-3 times a week). It wasn't enough to make up for 0 movement the rest of the time or consistent over-eating by "small" amounts.
I think because there were lots of "little" things, and the slow burn, I didn't clearly see the difference between when I was thinner vs larger. However, when I put everything together there is a massive difference of calories in vs calories out.
Maybe think about your lifestyle, diet and exercise when you were thinner and not putting on weight. Be honest with yourself about what is different now. But still do all the health tests recommended by others because it may be an underlying condition and nothing about your own behaviour.
Sending solidarity. I hope you find a solution soon!