A long time ago I thought this subject through. "What to say to someone struggling with illness or death." Having gone through both giving and receiving ends I have come to a conclusion on what works for me.
There are always the awkward, "I feel so bad", "just let me know if there is anything I can do", "You know I am there for you", etc. etc. etc. It is tough to be in the situation sitting outside watching a friend or acquaintance going through a difficult time. My first observation is that in the end, they are never going to remember anything you said. However, a struggling person always remembers your presence.
So the most important thing is your presence or appearance. I personally get very upset when I find out about someone going through a hard time and I was unable to see them. I used to dwell on that and beat myself up a lot and have reasoned that it is fruitless. If I find out late, that is just how it was meant to be. I try really hard to make an appearance when I do know someone is struggling.
I show up, give them a hug, and say. "Hey, it is really good to see you." It works and when it is done from the heart it goes a long way. Maybe this will help somebody out there...that would be great. Maybe someone else has their own suggestion? I am always open.