Great questions! Since it’s such a sensitive topic and many people have differences in pain, anxiety tolerance etc, I’m a bit hesitant to give my two cents about the biological ( vis a vis pain and meds) and psychological aspects of dying process ( I don’t know!)
But I found this selection that may answer some of your questions
Ajahn Brahm has talked extensively about this topic so I recommend this link as a starting point.
This forum has many topics on the subject as well, I would search using some key word like ‘ dying process’, ‘ deathbed contemplation’ etc
As a starting point for you, I found these very useful…