One Bible verse that is always helpful is 2 Corinthians 10:12 "...but when they measure themselves by one another and compare themselves with one another, they are without understanding." Measuring myself by someone else will make me lose every time. I'm either belittling my own sin or raising myself up above someone else (both inaccurate and detrimental ways to think...) If I'm interested in comparing, I ought to compare myself to Christ every time, which will remind me of my need for Him and bring about humility and thankfulness.
"Self-Knowledge," a prayer in the Valley of Vision, has some helpful things to say about this...
for sinners bring judgment in thinking sins are small,
or that God is not angry with them.
Let me not take other good men as my example,
and think I am good because I am like them,
For all good men are not so good as thou desirest...
I pray that the next time I am tempted to compare myself to others (whether to lift myself up or jealously wish I was like someone else) that God reminds me quickly that the only one worthy to be held up for comparison is Christ himself.
**If anyone has any books on this topic that you have found helpful, please let me know!**