When a person tells you that a loved one has passed, ask what the their name was and say it back. It can be awkward when that comes up and you might not know how to respond best. I’ve found that most people don’t want you to feel bad for them, but them saying their name and having a chance to talk about them is often a nice thing.
I’m in healthcare so death comes up a lot. “David. That’s a nice name. Where was he from?”