Rowling created Dementors as a metaphor for depression.
Many have theorized that Dementors were a symbol for depression, and Rowling confirmed this. "That is exactly what they are," she said in a 2000 interview. "It was entirely conscious. And entirely from my own experience. Depression is the most unpleasant thing I have ever experienced. It is that absence of being able to envisage that you will ever be cheerful again. The absence of hope. That very deadened feeling, which is so very different from feeling sad. Sad hurts but it's a healthy feeling. It's a necessary thing to feel. Depression is very different."