An inherent problem of the DSLR (reflex) technology, that does not affect mirrorless models, is the focus calibration.
DSLRs find the focus based on the image reflected on the mirror, and it is always a little bit different from the image projected on the sensor. The result is a degree of focus error, that is always there and it will vary from negligible to severe. Since the manufacturers are always upgrading lenses and sensors, issues like this were mostly theoretical for film, but are commonplace now.
In photography jargon, we say that a camera has "back focus" when autofocus settles behind (farther than) the subject, and "front focus" when it settles before (in front of) the subject that should be focused.
I have found, in the worst way possible, that a lens of mine (a 18-140mm zoom) got a case of front focus. Worse: it is front focusing for a zoom range only, from 18 to 35mm! After two days in the field, I saw that many pictures didn't get the tack sharpness that we expect from a DSLR.
Many things can cause focus deviation. The camera body might be broken, or just miscalibrated. In this case, all your lenses will show the same deviation. Not my case; the tests I made (will talk about them later) showed that a prime f/1.8 lens did not misfocus. I have bought and sold a number of lenses and never had this problem, either. So, in my case, the zoom must be itself the problematic part.
It is common to have focus issues in specific combinations of camera and lens. This 18-140mm zoom is problematic here but it might be perfect in some other camera. Because of that, advanced models have per-lens AF fine tuning. Unfortunately, my D3200 is a basic model without this feature.
To illustrate the problem, I will show three sample images. They are crops of pictures taken with the zoom at 18mm (wide angle) focal length. The buildings are 1/3 mile away and the crops have less than 300 effective pixels wide, so the lack of details is normal. (Click on the image to see the original crops.)
The picture above was focused with Live View. In this mode, a DSLR works like a mirrorless and calculates autofocus based on what's seen by the sensor itself. Focus and sharpness are the best possible, even though focusing can be slow.
The image above was shot with single-point AF, using the center focus point of the viewfinder. Clearly, the focus is bad. The whole picture would still be casually usable e.g. to post on Facebook, but it lost the "punch" of a DSLR picture.
Now, yet another picture, also focused through the viewfinder, but with a little trick:
The Nikon D3200 has 11 focus points in the viewfinder. In the picture above, I employed a different focus point, "northwest" off the center point (above and to the left). Using this point, the autofocus almost nailed it, even though the Live View version is still better. (This difference is already within the variation caused by other factors, like camera exposure and RAW conversion parameters.)
So, the short story is this: I found a workaround to avoid the front focus problem in my 18-140mm lens, by focusing on a specific viewfinder point, and recomposing if necessary. The advantage of this gimmick is, it can be used for the whole focal range, since all focus points work well for focal lengths that are calibrated.
Another simple and effective method of working around the problem, if you can't replace or fix the equipment, is simply to use Live View. Inexperienced pepole even prefer this mode instead of the viewfinder, and may never discover that her equipment is miscalibrated. Actually, using Live View is recommended when the absolute highest sharpness is desired, because the mirror-based autofocus is always prone to small deviations, even for top-notch equipment in perfect condition.
Detecting whether the issue exists or not, is easy. Just shoot the same subject with Live View and through the viewfinder, and compare the pictures with 100% zoom. If the viewfinder version is considerably less sharp than Live View's, your equipment has a focus issue. (Remember that Live View is always sharper, so a tiny difference shouldn't be considered a defect.)
Shoot test pictures with ISO 100, in daylight or using flash, with minimum aperture (smallest f-number). A slow shutter, or the noise of high ISOs, would rob sharpness and literally blur the comparison. A higher aperture (higher f-number) would increase depth of field and can mask the focus error.
The easiest subject for the preliminary tests is a landscape, since the focus is at infinity. This is suitable for almost every modern lens (Canon, Nikon AF-S) since they can focus beyond infinity. Older lens (e.g Nikon 50mm 1.8D) have a hard stop at infinity focus, so it can't back focus on a landscape, and back focus cannot happen when shooting distant subjects.
Once you know the problem is there, the boring part is to determine the details and nuances.
First off, you should determine whether it is a body problem or a lens problem. If you have more than one lens, make the same test with all lenses. If all show the same problem, it must be caused by the camera body. If the problematic lens is a zoom, it may well happen that the focus is deviant just for a range of focal lengths.
Then, we must find out whether the autofocus error is in the short side or in the long side. The typical method is to make a line of small and uniform objects, e.g. cells or toy soldiers, shoot them from an angle, focusing on the middle item. If the best sharpness fell on an object behind the middle one, the equipment is back focusing. If the sharpest part is in front of the middle item, it is a case of front focusing.
Again, the zoom muddles the issue because it is perfectly possible that a zoom lens is front focusing at wide-angle and back focusing in tele. Many tests are necessary to pinpoint these particularities. Take notes at each step, so you don't lose track of your observations, and confirm initial conclusions with more tests.
Another problem that a DSLR might have, is an offset of the viewfinder focus points. The DSLR does not focus exactly on the little dot; that dot is etched on the viewfinder glass, it is not painted by the focus circuit. This would make difference when focusing on diagonal scenarios; if the viewfinder is completely filled by a flat subject, that offset wouldn't make difference. Try to focus with the body in different orientations (sideways, upside down). If the camera orientation seems to make a difference in focus, perhaps the autofocus is ok, it is just "looking" to a slightly different spot.
Finally, focus deviations tend to affect different focus points differently. I guess that this happens because the issue is caused by some crooked part within the lens. In my lens, the north/northwest points are almost unaffected, and south/southeast points are the worst. To discover that, it is necessary to make tests with every focus point.
It is advisable to make these tests with every new piece of equipment that you buy or get, so it can be replaced right away, or at least serviced while covered by warranty.
Once you determine that the problem is related to a body or to a lens, the best thing to do would be ask for a replacement, or send it to be serviced. Sometimes it is not possible, e.g. when we buy or are given second-hand equipment.
The decision is a bit easier when the body is the culprit, because the body can be calibrated by the manufacturer using screws or even by software. On the other hand, it is probably not worthwhile to fix a lens.
Advanced cameras (e.g. Nikon D7x00) have per-lens focus calibration (AF Fine Tune). If you have made all tests and are absolutely sure of the magnitude and quality of the deviations, you may try this feature.
The most straightforward way to work around an autofocus problem, is simply to use Live View.
Another simple method is to use a slightly higher aperture, that increases depth of field, and might even mitigate the focus deviation by itself. This works when the deviation is small. Very high apertures will rob sharpness due to diffraction, so it is a trade-off. Again, many tests are needed to determine the best aperture.
If the lens has a manual focus ring with instant override, you can determine the amount of adjustment that offsets the problem. In my lens, 3 "teeth" of the focus ring texture compensate the front focus. But I must not make this adjustment in focus lengths above 35mm, otherwise I would be spoiling the focus that was perfect in the first place.
Using manual focus would be, at first sight, another workaround, mainly in case of lenses with hard-stop at infinity. To shoot a landscape, just twist the focus ring until it bumps infinity.
Except for that particular case, manual focus won't solve the problem because the viewfinder also gets the image from the mirror, so both the viewfinder and the autofocus system are equally fooled. To make things worse, modern cameras don't have microprisms or split-screen image on viewfinder. Operating the manual focus depends on electronic indicators, that are wrong anyway, so it is useless.
I noted one thing: in my lens with front focus, there is a quite wide focus range that the camera indicates as "perfect focus". The actually perfect focus is at the extreme right of the tolerance range, but still within the tolerance! Depending on the mood of the manufacturer, it could claim that my lens is "good enough" and would refuse to service it.
Once you know the actual perfect focus lies on a given point of the "good focus range", then you can use manual focus as a workaround, always having in mind that electronic indications are wrong. In short, you know that the camera is biased to one direction, then you bias the focus to the other direction to (try to) cancel it out.
Since it is likely that some crooked component is causing the problem, every focus point will be affected differently, as indeed is the case of my lens. Finding a focus point that is good, or not as bad as the others, and use it for autofocus, is the best workaround I found.