Hospitals are "falling short" on providing proper care to dying people in their final days and hours, a new review has found.
There are "significant" variations in care provided by hospitals across England, according to the National Care of the Dying Audit for Hospitals.
Around half of all deaths in England occur in hospital.
But experts have said that major improvements are needed to ensure better care for terminally ill people.
And more needs to be done to support patients' families, carers and their friends.
Many medics are failing to communicate properly with dying people or their loved ones and hospitals "do not recognise this as an important issue", the authors said.
The audit, led by the Royal College of Physicians (RCP) and Marie Curie Palliative Care Institute Liverpool, concluded that all staff who care for dying patients need to be specifically trained in the care of dying patients - particularly in communication skills.
Researchers assessed the quality of care received by 6,500 people who died in 149 hospitals across England between May 1 and May 31 last year.
They also questioned 850 bereaved relatives and friends and assessed services available in each organisation.
For most patients, healthcare workers realised they were in their last days of life, but less than half of patients capable of discussion were informed of this.
It appeared that dying people were also left out of clinical discussions, for instance 17% of patients were told they were being assessed to see if they needed artificial hydration or nutrition.
And one in five were asked about their spiritual needs.
Meanwhile, 24% of bereaved loved ones said they did not feel as though they were involved in decisions about care or treatment.
Some 37% reported that the overall level of emotional support given to them by the healthcare team was fair or poor.
And a quarter said they did not feel adequately supported during the last two days of their loved ones' life.
When the researchers assessed the hospitals, they found that mandatory training in care of the dying was only required for doctors in 19% of hospital trusts and for nurses in 28%.
The authors made a series of recommendations to improve the care of dying patients.
They said hospitals should provide a face-to-face specialist palliative care service from at least 9am to 5pm, seven days a week, and decisions about care of dying patients should be made by multidisciplinary medical teams and discussed with the patient or their family where appropriate.
All hospitals should undertake a local audit of their care of dying patients and they should have a designated board member responsible for palliative care.
Dr Kevin Stewart, chair of the audit's steering group and clinical director of the RCP's clinical effectiveness and evaluation unit, said: "Although some aspects of care are good in hospitals in England, I am deeply concerned that some hospitals are falling short of the excellent care that should be provided to both dying people and those important to them.
"In particular, communication with patients and their families is generally poor.
"It is disappointing that hospitals don't seem to recognise this as an important issue, not just for those experiencing this in their own lives, but for the wider public.
"Everyone wants to know that if they are in the same situation, their needs and those of their families, friends and those important to them will be met, with clinically appropriate treatment, sensitivity and compassion."
Professor John Ellershaw, director of the Marie Curie Palliative Care Institute in Liverpool, added: "It is unacceptable in the current day and age that hospitals are failing patients, and their families, in the care they receive at the end of their life.
"Too many patients are dying badly in our hospitals when we know how to care for them well.
"If some hospitals can provide good outcomes in care then all hospitals can.
"This audit provides a clear challenge to those hospitals that are failing to provide best care for dying people to look at why they are failing and improve."
Dr Jane Collins, chief executive of Marie Curie, which funded the research alongside Public Health England, said: "There's only one chance to get people's care at the end of their lives right but we know that our hospitals do not always provide the high quality care and dignified death that we all have the right to expect.
"The recommendations of the audit are clear.
"In particular, more needs to be done to improve governance, staff training, access to pastoral and specialist palliative care teams.
"We need everyone involved to take decisive action to ensure dying people and those close to them get the care and support they need and deserve."
Care and support minister Norman Lamb added: "All patients should be receiving high quality and compassionate care in their last days of life - there can be no excuse for anything less.
"This report shows evidence of very good care but I am seriously concerned about the variations in care, and improvements are needed in the way some clinicians communicate with patients and support families.
"I am determined this should improve.
"To help address these issues, we are working on plans to support all services in giving everyone in the last days and hours of life, and their families, the good quality, compassionate care they deserve."
Shadow health minister Jamie Reed said: " The Government needs to take urgent action to improve the quality of care for people at the end of their lives.
"At present, ministers are presiding over a postcode lottery in palliative care. It's unacceptable that in some hospitals patients aren't getting the standard of care and support they deserve, especially at weekends.
"It's also the case that too many people, against their wishes, end their life in hospital. Labour wants to work towards giving people the right to die at home, with their friends and family around them."