There appears to be certain trajectories that people follow(ed). Finish school, go to uni, get a job, have a few years of fun, find a partner, get married + have kids + buy a house (any order if that last combo).
Or the finish school, get a job, move out of home, have some years of fun then get married + have kids + buy a house (any order if that last combo).
There are others, but those are very common ones.
When we don't follow one of the most commonly tread paths, we feel that we're wrong, because humans are social animals and we naturally compare ourselves to others and instinctively feel we should be like the others.
Those trajectories above are also the ones we find reinforced by the media and they stop with the "get married + have kids + buy a house (any order if that last combo)" because then it's all "happily ever after".
Except for most people it's actually not.
So back to you. It's normal to look around yourself and also to compare yourself and also to see these trajectories (or others) and feel that you're not on one of them. It's also logical to feel left behind. That doesn't actually mean that you are. You're on a less commonly tread path.
But you're not the only one.
The impact of difficult life experiences/mental health problems from childhood are massively underestimated by loads of people. The school system brings people through a chronological set of tasks. And the flows into the first few years of working or uni then work (even longer if someone trains to be a dr though). After that, we all get dispersed but we've been set up to look at people our age and look what we're doing/achieving in comparison to them. It makes life easier in a way because when we're already emotionally burdened by our past or present life circumstances/genetics, we "just" need to go to school, learn enough and pass tests. After we leave education though, the weight of the emotional load can become harder because now we have to figure everything out. We have to find out own path, rather than turn up and do what we're told.
This is long, but maybe it helps to see that comparing is really normal and expected in humans. But the age comparison is particularly not helpful after we've finished school/uni.
You don't need to beat yourself up for comparing, because it's normal to compare.
You don't need to beat yourself up for feeling like you're behind, because you actually can't be behind people who are on a different path to you - especially when the actual end of all paths is death (which is better not dwelled on anyway ).
You ask how you can stop the comparisons. I'd say don't bother with that effort. We only have so much energy anyway and when we're struggling with mental health issues we usually have less to spare.
What do you enjoy doing? What's something fun you'd like to try, in particular small things? I'm not talking about visiting the pyramids before you die, more like trying a recipe for something, an activity you'd like to do that haven't got round to. A film you've been meaning to see but didn't. A book you wanted to read. A game you wanted to play. I don't know you so I have no idea what makes you happy or what little things you might like. Things that make today and tomorrow better than yesterday. Covid is in the way of a lot of things, so you might have to get creative.
Work your way through the list - according to what takes your fancy, don't work your way down the list, unless that makes you happy! Add new things to it when they come up.
If you spend your time trying not to do something, you're still giving your energy to it. So really, my opinion on this is to focus on doing fun/interesting/stimulating things instead, but, that might not be the best for you either! You know yourself far better than this online random person!