Highway patrol officers have a similar risk profile to construction workers. Mostly car accidents. Patrolmen in cities or towns get hurt in town or in altercations all of the time.
Court officers do not. Detectives largely do not. Police are more likely to get shot at, but way more likely to get hurt in a bunch of acute and long term ways. The nature of the stress that many police experience measurably shortens their lives.
The biggest issues with police with regard to officer and public safety are poor governance and macho culture. I live in New York so I’ll use them as an example. NY State Police are highway patrol focused - they wear grey and black uniforms and Stetson hats. NYPD Highway patrol units wear black leather jackets and cavalry breeches. It looks cool and has a certain elan — but officers would be safer in more functional dayglo attire.
In terms of governance, like many areas of American governance, checks and balances are weak. Example: Cozy relationships between various departments, prosecutors, and perhaps elected judges mean that many NY police avoid prosecution or and sanction for DWI.