Don't tell a friend who is struggling that others have it worse. Even though others probably do have it worse, that is not what your friend needs, or wants to hear. Don't invalidate their feelings.
How would you feel if you were upset or struggling with something, and your friend told you to think about the fact that others have it worse? From experience, I know that it doesn't help. It makes you feel worse. It makes you feel like your feelings aren't valid, but they are.
So, I'm taking a stand against telling those who are struggling that others have it worse. Think about it. Telling a friend that their situation isn't as bad as yours or someone else's also tells them that their situation doesn't matter, which is probably not what you were trying to say. Next time, be more sensitive to the situation, and let your friend know that their feelings are valid. Tell them, "I know that this is hard, and it's okay to feel this way." Take a stand.
I'm sure you want the person you're confiding in to validate your feelings when you're upset or struggling, so you need to do that for others as well. Treat others how you want to be treated. You want to hear that it's OK to be upset. Your feelings are valid, and anyone who says differently is wrong.
On the other side of things, if you are told by someone that others have it worse, don't kick them aside and hold a grudge. They are probably just trying to help you feel better. Just let them know that you know others might have it worse, but it doesn't make your situation any better. Tell them that your situation and feelings matter. You're allowed to be upset, angry, frustrated, sad, etc. Your feelings are valid.