If you are reading this with a loved one who is facing their own mortality: I'm so sorry.
Whatever the circumstances it is a hard, heart rending time.
Here is some basic information to help you feel more calm, confident and in the present.
First and foremost it is important to take care of yourself. You must apply your own air mask before helping others- said every airline ever. My top three tips are:
1) Drink water. All the time. B vitamins wouldn't hurt either.
2) Get outside everyday preferably multiple times. There is something about being under the sky that can right our ships in the stormiest of weather. If your mind is racing focus on your senses one at a time and name five things that sense picks up.
For example, name 5 things that you see, (then five things that you smell and so forth). It is an exercise in getting you back into your body.
Finish by standing still and taking some deep breaths with slow exhales. 4,5,7 comes to mind. Breathe in for 4, hold it for 5 and release it slowly for 7,
3) Eat good food. Not 'fakey good' which is food that tastes good but isn't actually nourishing, but good good. You would be surprised at how easy it is to forget.
For your person who is dying
1) Allow them to talk about what is happening to them. In their bodies and their minds. Listening is the most healing thing you can do for them. You might start the conversation with, "What do you want to do with the time you have left?" or "Is there anything that is weighing on you right now?" "Is there anything you want to talk about?" As they are sharing try not to offer advice or fix anything unless it is very, very clear that is what they are asking of you. I find it helpful to say "Tell me more about that." Allow time for silence. It is in the silence that the most work is being done. If you fill it with banter the opportunity is lost. You are holding space for them to do their work.
2) No matter where they are make the space around them sacred. Clear the room of clutter. Soften the light, Add music or candles if that is wanted. I love the smell of beeswax melting, but maybe for your person it is lavender, or chocolate chip cookies baking, or their favorite pot roast. Whatever is comforting to them.
3) A big part of making the space sacred is controlling what happens there. If you compare it to a woman in labor you will get the idea. You wouldn't sit and talk shop in the labor room. The same courtesy should be extended to the dying person. This is hard work and they do not need to be pulled away from it by unnecessary distractions. A birth doula once explained it to me this way. A woman in labor is like being in the middle of this river. The doula's job is to keep the woman there so she can do her work. The doula controls what the atmosphere in the room is like per the previously given instructions from the woman herself. The doula alerts her to who is coming and going so there are no jarring surprises. It's much the same with death. The dying person needs to be able to recede from this world in their own way and not be called back by sounds and lights that could be startling.
4) Some of the work of dying can be difficult to witness. There can be an uncomfortableness about it that cannot be totally mitigated. It is important as the caregiver to stay calm, do what you need to do to take care of yourself. It is also important to keep hospice up to date about any and all symptom changes. Pain is much more difficult to control when you are behind it. There are medications for anxiety and agitation. Hospice can only be there 5% of the time but they are always only a phone call away. Unfortunately during such an intense experience it can be easy to forget to call. I've been there.
5) Hire a doula. At least have a conversation with one. I know how hard it is to involve one more person into the mix, but believe me you owe it to yourself to at least have a conversation with one. I can virtually guarantee that it will make you feel better. Less alone. Less stressed. Less at a loss as to what the next step is.