As a GM, one of your responsibilities is to make sure that your players are connecting with their characters and really placing themselves in their character's shoes. There are a few ways to go about this; one is to really try to act in character with them via roleplay, one is to give them meaningful moments that let their abilities shine, and my favorite? Hurt them.
Nah, I'm not suggesting you reach across the table with your fist full of unrolled dice and punch your brother in the face (that's between you and your brother). I'm saying to hurt the character, and in turn hurt the player. There are multiple levels to this philosophy.
EMOTIONAL DAMAGE: One of my favorite things to do in my games is to create bonds between my players/PCs and my NPCs. As a GM, you'd think this would generally be top priority but sadly sometimes especially new GMs are overwhelmed by the sheer number of NPCs in the game. There are multiple benefits and almost no downsides to doing this in your games. It not only creates narrative opportunities, but also if you go with my route you can make the players hurt by letting a beloved NPC die during a crucial moment when the PCs have exhausted all their resources and there's nothing left to heal their comrade. It creates all the drama of a PC death but you don't needlessly kill a PC, and as a result the PCs can bond over something traumatic. In the first campaign some of my grad school friends ever played, I had one of the characters (Boddynock the gnome Wizard) become close to a local single mom and her son (both halflings). When the BBEG came into the picture, it was only a matter of time before they found out what the PCs held near and dear to their hearts and in one memorable session, Boddynock discovered the hung bodies in the mouth of a cave of his beloved halfling lady and her son ala the movie Gladiator. He had wanted to switch to being a Warlock and it became the perfect time to do so, as his anger drew the attention of a demon who gave him power in return for becoming his vassal. Obviously, you should check with your players if any topics are off limits for them, and explain to them that your campaign may be dark or complex and not lighthearted all the time. The important thing is that ultimately it becomes a memorable experience for their characters and their development.
LET'S GET PHYSICAL: Aside from emotionally torturing your poor PCs, another thing you have to remember is that physical exertion and damage result in pain and difficulty and it's nice to remind players about that by really encouraging them to roleplay body damage or fatigue in game on their own. There are several charts if you're using 5E that simulate injured body parts. In my games, if someone gets a Nat 1 then that means something bad happens. It can really be anything, but I try to make it feel natural with whatever's happening at the moment, and a lot of the time it's that the players are physically hurt in some way. They're either hit by a stray arrow, or slip down a flight of stairs because of some goblin blood. Every once in a while if a monster Crits, then I use a table where I can see if the player gets broken ribs or loses a hand, etc. Obviously, again, you'd want to tell your players this is a possibility from the get go. And don't just let the players get up like nothing's wrong after a healing spell. Their body will still be sore and exhausted at least for a few hours. It makes the combat more exciting when the players feel like their characters really might not make it. So make sure to remind the players after they regain 12 hp that even though their wounds are closing up, they still feel stiff and sore and the area is tender. Don't let them off that easily. The most memorable times your players will talk about in the future will be when they overcame great odds.
BALANCE: Of course, if you kill every character your PCs end up liking, or never let them win, you'll find yourself alone and not running games anymore because you're too depressing to play with. For every time I make my PCs sad, I spend twice that time building them up and letting them have exciting wins and shining moments. It's all about balance. If you let your PCs steamroll everything with no consequences, they'll grow bored and feel no stakes. Likewise, if you make things impossible and they can never find a moment's respite, you're going to give them PTSD and make them avoid sessions or quit your campaign altogether. Balance works with the Force, and it also works in TTRPGs. In the words of one of my favorite films, Vanilla Sky; “One day you’ll know what love truly is, it’s the sour and the sweet. And I know the sour, which allows me to appreciate the sweet.”
Don't let your players have the sweet without the sour, or vice versa. But make sure to give them enough of the sour in the first place. How do you make your players hurt? Let us know in the comments!