When to charge by the hour

Good morning all! I'm hope everyone's doing well. I was recently updating my pricing as I charge by an estimate of how long things MIGHT take me by not how long they ACTUALLY take me. I prefer this method because I receive payment up front but there are times when I've charged and kick myself because the work takes drastically longer then I've estimated. For those who charge by the hour, what services do you do this for and how do you determine the rate you'll charge? I had a client a few days ago and get ticket was only 750… she shouted how wonderful it was that I was SOOOOO CHEAP because she'd budgeted 2500! 🤦🏽‍♀️ My heart crumbled in my stomach and I jokingly said well you could apply some towards the tip 🤣 she ended up tipping me 250.. which was nice but I can tell my pricing is severely lacking. 🙃💔Thanks in advance!