What a bunch of bullshit that phrase is. I cringe every time I hear someone say that to someone having a hard time. It’s often a flat out lie. Even at best, it’s a platitude that only serves to minimize whatever situation a person is dealing with.
The only person getting comfort out of this phrase is the one saying it, because they can’t think og anything else to say. So they settle on some meaningless, insulting platitude and pat themselves on the back for how comforting they are in someone else’s time of need.