It's easy to put on weight without noticing it much oneself. For example, I knew that I'd put on a
bit of weight (largely due to cancer treatments) but I didn't recognise just how much until I happened to catch sight of my profile in a store's full length mirror.
So, if others say that you've been putting on weight, it's highly likely to be true.
Whether that matters though will depend upon
(a) what your 'starting point' weight was a couple of years ago ; and
(b) just how much weight you've actually put on.
BMI is often criticised for being an imperfect measure of a 'healthy' weight but finding out your own BMI would still be a good starting point in determining whether or not your weight gain is anything to worry about:
https://www.nhs.uk/live-well/healthy-weight/bmi-calculator/