Don't shoot wide-open at close distances...it's pretty simple...avoid wide-open when at close range. That solves about 8o% of the problem with missed focus. Moving BACK, away from subjects, gives a lot more DOF than when you are close. If you're shooting a 50mm lens from inside five feet, you'd better be prepared to miss focus at least occasionally; and anyway, if there is any light to speak of, shooting at f/1.8 or f/2 inside of five feet with a 50mm lens is just not a "best practice"...you might as well stop down to f/4 to have enough DOF to just barely cover any miscues,mistakes, or mis-placement of the focus point.
The various online DOF calculators can show you how skinny the DOF is at various f/stops and distances and focal lengths with different camera formats (APS-C, m4/3, FX,etc). But as far as for practical, real-world picture taking, you can't use the data except for the most basic concepts, like, "How much DOF do I have at 15 feet for a family group done at f/5.6?" and things like that; when actually taking portraits or other pictures, the depth of field preview button on the camera can help, somewhat, but it's not a perfect solution. The LCD screen can help, allowing you to actually zoom in and look critically at the focus that was achieved.
With most lenses, there is a marked quality improvement by closing the aperture down just one f/stop value from wide-open. Many 50's look a bit "dreamy" when shot wide-open; same with many high-speed 85mm lenses; closing down two f/stops from wide-open at close range is a general guideline that I try to follow...I do not WANT to be wide-open very often with any 50,85,or 105mm lens....I wanna be two stops down from wide-open, where the lens is crisp, and I have just a tiny bit of error protection at close distances. I like my 85mm 1.4 at f/4.0, which is three f/stops down from wide-open. I like my 50's at f/3.5 to f/4.
When shooting with telephotos, I often like f/4.5 or f/4.8 or even f/5.6.