Dementor's were used by the Ministry to administer punishment. In their presence you are influenced into a depressed state, however when used as punishment, a "Dementor's Kiss" sucks the soul from a prisoner's body, leaving them in a state of perpetual unhappiness (an understatement):
"Dementors are among the foulest creatures that walk this earth. They
infest the darkest, filthiest places, they glory in decay and despair,
they drain peace, hope, and happiness out of the air around them...
Get too near a Dementor and every good feeling, every happy memory
will be sucked out of you. If it can, the Dementor will feed on you
long enough to reduce you to something like itself... soulless and
evil. You will be left with nothing but the worst experiences of your
Harry explicitly remembers the effect the Dementors had on him:
‘I did think of Voldemort first,’ said Harry honestly. ‘But then I – I
remembered those Dementors.’
‘I see,’ said Lupin thoughtfully. ‘Well, well ... I’m impressed.’ He
smiled slightly at the look of surprise on Harry’s face. ‘That
suggests that what you fear most of all is – fear. Very wise, Harry.’
I can imagine that the worst possible fear he had was losing the feelings and memories he had of his friends and his mother and father. As we see later on, he doesn't fear the idea of death itself, it's the fear of eternal despair that most troubles him.
Much like a convicted murderer, I'm sure the very act itself would haunt you unless you were completely heartless, and sitting in a jail cell for possibly the remaining days of your life would eat away at you relentlessly. It's a common thing to hear when people talk of someone that has done something terrible, they say "Death would be too kind for them, let them rot in a jail cell and think about what they've done".
It's the fear of this that takes the heart of Harry. Eternal hell.