Say Three Little Words
Say, "I know you are hurting, and I really care about that. If you want to talk about it, I'll listen." Then let the person talk without interrupting.
Tell me, "You have been in my thoughts." That is a greeting which will allow me to choose my response. If I feel a need to share any feelings or thoughts, I can do so, or I can choose to say simply, "Thank you," and go on to talk of other things.