There are two kinds of anxiety in people: the kind that is fleeting, and the kind that is debilitating.
If you have these thoughts and they pass you by (which I assume isn't happening due to the fact that you felt the need to make this thread), then accepting that they occur and letting them pass over on their own is the best approach to this.
If, however, they are causing you extreme distress and are persisting, there are some other coping mechanisms that could be employed.
For this particular kind of anxiety, a part of it
is going to be a degree of acceptance: both of the fact that these thoughts occur, and that the concept behind your anxiety is an inevitable element of human existence.
Some might find it helpful to do something directly logic-oriented (essentially "negotiating themselves down" or "putting their mind on trial") in order to 'reality test' their thoughts. This might not be as beneficial unless your anxiety comes with cotard delusions (i.e, you are dying, already dead, or are missing blood or vital organs).
Others might recommend the grounding techniques. This anxiety is not something that can necessarily
always be refuted with logic-oriented argumentation, so sometimes it's best to mitigate these things in the moment and let your mind phase them into the background/unconscious, empowering you to disseminate your distress. There are several methods to grounding, the most popular being the "5-4-3-2-1" model, which can be found
here. It is often found helpful for many with anxiety to unwind their mind and stop racing thoughts by immersing themselves in a neutral environment with neutral stimuli. This method can be effective for anxiety attacks provoked by these intrusive thoughts.
Other methods might be more action-oriented, like thought re-frame exercises commonly found in dialectal behavioral therapy. Essentially, when you come across a negative thought in your mind, you turn it into a neutral one. For example:
The thought that I will die is causing me to panic.
Becomes:
Dying is something that is inevitable, but it's better to live in the present.
This is not the best example (but it's 2:43 am as I type this so cut me some slack).
Alternatively, other re-frame models follow the lines of flipping the situation in a small "role reversal" technique. So, for instance, supposing a friend comes to you with these qualms about having death anxiety. Think about how you might respond to their situation. Sometimes we are more generous with our voices of reason and compassion when it comes to those we love than we are with ourselves.
Anyways, I hope this helps.
I'm really sorry that you're coming across these feelings of dread and apprehension.
Get well soon!