First off, the answer is not “I’m sorry for your loss.”
Did you do it? No, so stop repeating the typical shit.
Second, it’s not “how are you doing?”
How the fuck do you think they’re doing? Terrible! Don’t force them to do the work, use your brain and stop being lazy.
The right thing to do is usually just to tell them you love them and give a hug. Maybe share a story of the deceased if it’s appropriate. Or, just hug them and don’t say anything.
Forcing people to have to cater to your awkwardness is not the answer.
I can unfortunately speak about this from experience. Between 2018-2021 I lost both grandmas, grandpa, and unexpectedly my Dad to a heart attack when he was only 60.
The absolute worst thing to hear was when people told me to “be strong for your Mom.”
Fuck off.
Do the grief stricken person a favor and lighten their load. It’s heavy enough.