You may compare yourself with others because their visible achievements trigger questions about your own progress, security, recognition, freedom or sense of fulfilment. Social media can intensify this because you see selected highlights rather than someone's complete life.
https://www.wisdom.vedaspark.com/blogs/why-do-i-keep-comparing-my-life-with-everyone-elses