In practice, mistakes are made, regularly, and these mistakes are distributed unevenly, such that the poor and minorities suffer the most.
The many wrongful deaths at the hands of the government is a good reason to be skeptical of arguments which assume the death penalty can be applied perfectly. It can’t.
For a simple counter example, you can look up the Outreau case : 12 people were accused of raping and videotaping children, with multiple testimonies. And 5 years later, the majority of them were found to be actually innocent.
If death penalty was a thing in France, they would have got it for sure, as it was a very emotionnal case at the time.
You can also check the movie 12 Angry Men, which is a work of fiction obviously, but still very relevant on why counting on 'black and white cases with extreme evidence' is simply wishful thinking, and will lead to innocent people being killed
It was highly influential in the eventual abolition of the death penalty in the UK in the 1960s.
Because the cost of putting them to death using a system that has sufficient checks to (mostly) prevent innocent people from being executed (i.e. the current system, if you believe it works) is greater than the cost of imprisoning people for life.