The NHS has a set of guidelines for what to do when someone dies in hospital. If a loved one has just died in the hospital, the hospital will usually issue a medical certificate and/or formal letter.
They will support you with the next steps you need to take. The body will usually be kept in the hospital mortuary until the funeral directors or relatives arrange a chapel of rest, or for the body to be taken home.