OK, not every handgun has a safety. Glock is famous for that, as are a few others, but most guns do have one. If yours does, do you know for sure that it works? Test it unloaded (and of course, always point the muzzle in a safe direction), but also test it loaded, while at the range.
1911s typically have a grip safety, while most other guns have a thumb safety.
Safeties are not especially prone to failure, but they are mechanical, and anything mechanical can fail. Whatever causes one to fail could be happening intermittently, so it won’t fail every time, which is why you never point the gun at a person or a dog (OK, or a cat) and depend on the safety.
This came to mind as a topic when I bought another gun, a Walther, which has a very unusual safety. Instead of locking the trigger so it can’t move, this safety moves a steel plate between the hammer and the firing pin. The trigger pull stays the same, and the hammer still falls.
That’s actually a little disconcerting. With the safety on, there is no way to know if it will fire until it does fire, which is too late. Hmmm. Is that steel plate actually there? What if a trainee assembled the gun and left it out. Dry-firing doesn’t prove anything here. This has to be tested live.
Once again, never trust a safety, and test it periodically!