It can be argued[1] that only doses that are virtually certain to cause death lead to liability for the death, so no doubt there is some overlap between doses given to relieve pain and those that quicken death.
Diamorphine is also sometimes used for labour pain.[2]
[1] https://www.uhs.nhs.uk/HealthProfessionals/Clinical-law-upda...
[2] https://www.nhs.uk/pregnancy/labour-and-birth/what-happens/p...