Need some help with a question about communication English

I'd like to ask what should I do when other people say "I'm sorry to hear that" to me. Should I say something or just stand there and smile? I found it a little hard to reply properly when facing this kind of situation. Thank you so much for your help.

I've heard that "I'm sorry to hear that" is the wrong thing to tell someone because it does not show enough care.
They could say they support you.
You could say, thank you for your time listening to my problems.

I've heard that "I'm sorry to hear that" is the wrong thing to tell someone because it does not show enough care.
They could say they support you.
You could say, thank you for your time listening to my problems.
Oh, I didn't even know that. Thank you for your help.