Legislation covering the arrangement of funerals undertaken by Local Authorities and Hospitals in England and Wales can be found on the Governments website.
https://www.legislation.gov.uk/ukpga/1984/22
Section 46 of the Public Health (Control of Diseases) Act 1984 replaced the previous legislation (section 50 of the 1948 National Assistance Act).
In Scotland, Section 87 of the Burial and Cremation (Scotland) Act 2016 applies:
https://www.legislation.gov.uk/asp/2016/20/section/87
In Northern Ireland, Section 25 of the Welfare Service Act (Northern Ireland) 1971 applies:
http://www.legislation.gov.uk/apni/1971/2/section/25