When a friend trusts you with something hard, the best first words are usually “Thank you for telling me.”
GRATITUDE
GRATITUDE
Those words work because they answer the question the person is actually asking, which is whether telling you was a mistake. Advice, questions and reassurance all come too early and all land as a reaction to the content. Thanks lands as a reaction to them. It also buys you a few seconds, which you will need.
Keep the first sentence simple and about them rather than about the problem. Then ask what they need, if anything, and be willing to hear that they do not know. Save your opinion for a later conversation, if they ask for it at all.
What do you usually say first when someone opens up?
Free, with nothing to buy inside it.