Keep it simple. If they break up, express appropriate sympathy to each, separately. Maybe something like...
"I'm sorry for your loss. Please let me know if I can do anything in appropriate ways to help you in your grieving time -- bring you a DVD to watch, come walk the dog, do a load of laundry, take you to lunch to air out... whatever your TLC needs could be that I could help with."
You could choose to be compassionate, and just guard against "TMI stuff" or "being put in the middle stuff." Maintain your separate relationships with them separate. If either one edges close to the weird zone just say so.
Sometimes hurting people don't realize they are fuzzing boundaries because they cannot see straight right now. Just gently but firmly
scoot them back so they color inside the lines. Maybe something like...
"I see that you are feeling ____. But I'm not the guy on this one. Maybe you could talk about that topic with _____? I want to be appropriately supportive, and that starts to brush up into the weird zone for me. I'm better for ____(list the areas you are ok in)___. I can be the guy for that and support you there."
Keeps things simple, honest, and up front while still being appropriately compassionate, AND looking out for YOUR best healths in all this. It can feel messy or complicated, but it doesn't have to be. Just choose ethical behavior and be honest when you don't know something.
"I don't know what to do here. I'm sorry. I see you hurt though. I may not have answers and be just as confused as you but well... I can SIT here with you and we can be confused together then."
It is honest feedback. Sometimes the ministry of presence is just... to BE there for someone. Suffering with them in the weird so they don't have to suffer weird alone. *shrug* The human condition is what it is. When you do this for your friends, in time it gets less weird feeling for YOU anyway. More like... "Oh. This is one of THOSE times. Alright. Here I go again... apply ministry of presence skills here then!"
It will be ok. Hang in there.