I'm sure you know this, but that's a very dangerous mindset! People aren't meant to be compared; comparison implies a winner and a loser. The truth is that there are no losers here, just different people walking different paths.
Whether we like it or not, we are constantly being compared, and there is indeed a winner or loser. I'd argue that we shouldn't try to trick ourselves into thinking that there are no winners or losers, but to accept that it is totally okay, and even good, to lose.
But if you'd like, we could consider another case where we have two employees who have the same position. Since we're on HN lets say we have two junior devs. If the company decides it doesn't need both employees, one of them will be laid off. Obviously the person in charge will have to compare the two and decide which one to let go.
The only person you should be comparing yourself against is your former self. Always be better than them.