Think about the people who go to the pharmacy, in their condition, sick, addicted, in pain, impatient, insomnia, anxious, worry for them of for a loved one, their mind're not clear. Those things affect the way they communicate.
This is an excellent observation that feeds right into what I want to share with you: what I learned from years as an airline ticket counter, gate, and - worst of all - baggage service agent.
Before I start though, I commend you for asking about this and wanting to improve. That's impressive.
In my experience, the key is empathy. Literally, it means being able to see something from another's point of view (and the world could use a good dose of it these days!).
Most people just want to know that the person helping them gets it and gives a s***. So if someone is cranky because their prescription isn't ready, say something like, "I know it's frustrating to have to wait longer than you expected, and I'd be annoyed too if I were you. I'm sorry it happened and I'll let you know just as soon as it's ready." You'll be surprised how many people say, "Okay, thank you" and wait patiently for their meds.
(BTW, it doesn't matter whether it's the pharmacy's fault or theirs, which incidentally was one of the hardest things people had to get over in training.)
If someone is over the top p***ed, use this: "I'd be frustrated too if I were you, but as upset as you are, is there something other than this going on?" This usually results in one of two things: 1) the person realizes they're being a dick and calms down, or 2) they tell you the real reason they're mad. "This is the third time you people have taken longer than you said to fill this!" or in my work back then, "I reserved an aisle seat but got stuck in the middle seat anyway and then the flight attendant spilled coffee on my pants!" Once you get to that, you can say you're sorry and do what you can for them. A discount coupon or something, but just caring enough to acknowledge and apologize almost always helps.
And sometimes it's something completely unrelated and possibly heartbreaking, like "My daughter was just diagnosed with cancer and I'm afraid she's going to die."
We never know what strangers have going on in their lives, and that's a good lesson for everyone. Even if you can't do anything other than say, "Oh my God, I'm so sorry. I hope she comes through okay," you've defused their anger and shown a caring attitude that people will appreciate and remember.
These aren't tricks - you can't fake sincerity so they won't work if you really don't give a f***. I hope that's not the case.