For me, nothing worked and I lost them. It carved a canyon in my heart. Me and friends spent many months trying different things. What was apparent is that participation is necessary. If they don't want to be helped they basically can't be helped. Some people got basically isolated because they were too forceful. At that point what seemed key for me was to keep trust so I could intervene in the last minute, and so they don't shut you out. Be proactive in the critical time. If you want to intervene, know exactly what you're going to do, who to call, have a plan. I think it might be better to get someone put in a ward than to lose them, even if you're blowing up their life in the process. It was a question I mauled over for days.
If they're planning to leave, I felt that they should consider walking away from the things causing them pain. You can make a living being a surf lifesaver or a forest warden or collecting unemployment. If they're planning to leave, and, as I would speculate, they've tried nothing, maybe you can get them to try some stuff if they can lean on you as a fallback? You may as well quit your work and skydive or hike or travel or do whatever if you're going to end it, and some people have life changing experiences doing those things?
Cognitive behavior therapy is apparently surprisingly effective to engage with people who are interested in changing and recognize there is a problem.
If things are looking desperate maybe something insane and mind altering like microdosing ketamine or LSD or something, as these actually do change people a bit. If there's nothing to be lost, I'd try it.
I don't have any answers or advice. Good luck.