Stop comparing yourself to other people.
We are all individuals with different qualities. We start out life with different genes. We don't have the same values, desires, ambitions or dreams as other people. So there is no point in comparing oneself against another person and judging our value on that basis.
Take for example a person who feels badly because he cannot afford to take his wife on an expensive vacation for her birthday, like her best friend's husband did. He's not even thinking about whether his wife actually wants to go on that kind of vacation. Maybe he and his wife have chosen to spend their money on creating a beautiful home instead. Or maybe the wife knows that her best friend's husband is unfaithful and it's guilt that's making him appear so generous. She values other qualities in her own husband.
If there is any comparison to be made, it is just a question of comparing yourself with yourself. For example, you may notice that you performed better on a test than the last time, or with a challenging task at work. If you do this, it is important to be gentle with yourself if you find that you did worse this time. Look at the reasons for that, and how you can do better next time.