Comparing yourself against others can be demotivating. We don’t start out even so there will always be people in front or behind you. You ego will want you to be superior in as many ways as possible. If ego is self esteem then you need some to function. Too much and you become a nuisance to yourself. It’s fine to think that you are better than someone else at something you are skilled at or something you are born with but it doesn’t make you more important. The time you spend thinking about being better than someone else is time you could spend improving your skills or knowledge. It is a bit like looking ahead instead of looking backwards.
The only useful comparison is between how you were with how you are now. Are you improving your job skills or your interpersonal skills? Are you more mature? Are you achieving your goals? Are you living according to the values that matter to you?
If you find your mind comparing you against others, gently nudge it towards what you are actually doing in the present. Ask yourself, what am I doing to improve myself today?