I hope I'm never the type of person who has to "win" the "Whose-life's-harder/sucks-worse-right-now Olympics." Everyone knows or has known someone like that before. No matter the issue you have, they'll be ready as soon as they have the chance to tell you why you're lucky because their problem is worse. It doesn't matter what it is, they'll use something current or draw from a passed experience to attempt to one-up your issue. It's rarely done out of actually trying to help the person they're one-upping.
I understand needing to vent at times. I understand needing to complain about a pesky problem or a tough situation you're going through. Doing that usually opens the doors for the person lending that ear to share a similar story or at least one to relate to you. I'm fine with that because finding out someone you know has gone through a similar problem as you can, at times, be helpful. It can make you feel a bit better just knowing they got through it. You can discuss situational similarities and it may open your eyes to paths and solutions you hadn't yet thought of. A different perspective rarely hurts things when you're trying to work through something.
Just don't be that person who constantly tries to make all of their issues worse than anyone else's. That person whom has to make everything about them. All you're doing is saying, "that sucks for you but here's my problem that I deem bigger and more important than yours. Aren't you glad you don't have my problems? How lucky for you and your less significant problems!"
Doing that doesn't make the other person feel better and it makes you look like a self-centered jackass who doesn't care about what other people are going through. You don't need to prove your issues are bigger and more difficult or that things you overcame were tougher so boohoo.
We all go through struggles and hard times. It's a part of life and everyone processes and handles situations differently. You can't say that your struggle is harder than the struggle of a loved one because you don't know. And even if it is/was, they're not coming to you for you to tell them how lucky they are. So next time, try shutting it down, listening and offering up something useful instead of disregarding what they're saying so you can tell them how you have it worse. Life is hard enough on it's own but things are easier to get through with support and encouragement from the people around you. If you're unsupportive and more interested in everything being about you all of the time, eventually (some sooner, others later) the people you care about are going to get tired of it. It's exhausting and frustrating dealing with someone that acts that way, especially when it's someone you care for or even someone you love. You're not going to like what you start getting back so step out if your little "it's all about me" bubble and try on a little empathy on occasion. I promise, it doesn't hurt to occasionally just put your own issues aside and show the same kindness and support that you'd like from those around you.