You've indicated in a couple of comments that you find the focus/sharpness acceptable when shooting a static object from a tripod and manually focusing. That eliminates the softer image you get from this lens when used wide open as the issue you are trying to identify.
You've also indicated in another comment that you're using it with an EOS 200D (a/k/a Rebel SL2). This entry level camera has a fairly basic AF system. Only the center AF point is a cross type and more sensitive with lenses wider than f/2.8. The 200D does not have user accessible AF Micro Adjustment capability.
Whether due to hardware issues or technique, it seems you're missing focus in front of or behind your intended target. With a 50mm f/1.8 lens wide open at distances close enough to fill the frame with a face, your depth of field will be less than one inch (or 2 centimeters). That's very little to no room for error. Here are the issues you must weigh when deciding what AF points and compositional techniques to use:
- The center AF point on your 200D should be the most accurate one as it is the only cross-type AF point and is the only one more sensitive when using lenses with a maximum aperture wider than f/2.8.
- Using the center AF point to focus and then recomposing to place the point you wish to be in sharpest focus elsewhere in the frame is known as 'focus and recompose.' This can introduce errors as the distance from the lens' optical center to the focus target can change as the camera is rotated away from the focus target. Most of the error is usually because the photographer rotates the camera around an axis in the center of the photographer's body, rather than rotating the camera around the optical center of the lens.
- Lenses with a very flat field of focus demonstrate the most error from 'focus and recompose.' The EF 50mm f/1.8 STM has the same optical formula as the EF 50mm f/1.8 and EF 50mmf/1.8 II. They all demonstrate a slightly curved field of focus. While this makes the corners softer when shooting flat test charts with the lens focused at the center, it actually works to your advantage when practicing correct 'focus and recompose' techniques.
In the end you need to weigh the possibility that the center AF point may be more accurate than a peripheral AF point against the advantage of not having to move the camera when using a peripheral AF point.
Some things you can try to help improve the chances of getting the shot 'in focus.'
- Focus on the nearest eye. Our brains are wired to view the eyes as the most important spots on the face. If the near eye is in focus the face will usually look focused, even if some parts nearer and further than the eye are blurrier. If the nearest eye is not in focus the entire face will not look right, even if other parts of it are in focus.
- Stop down a little to increase the depth of field. As already mentioned, at three feet subject distance a 50mm lens at f/1.8 has less than an inch of DoF. And that's assuming the image will be viewed no larger than 8x10 inches. If we change the display size and/or viewing distance of an image, we also change the depth of field of that image. Keep in mind that pixel-peeping a 24MP image file on a 22" HD (1920x1080) monitor at 100% is the equivalent of looking at a part of a 60x40 inch print!
- Use a tripod to stabilize the camera. Often what we think is missed focus can actually be blur caused by camera movement.
- Use a high enough shutter speed that subject movement isn't an issue. If you are indoors this usually means adding flash or more continuous lighting to the existing ambient lighting in order to have a bright enough scene. Bumping up the ISO doesn't add any light, it just amplifies what is there. But it also amplifies the noise in the image and using noise reduction also reduces image detail. Even with static subjects, a well lit scene will look 'sharper' that a poorly lit one. The extra light allows more contrast between the details in the scene.
- Don't focus so long before you take the shot that your subject has too much opportunity to move closer or further away from the camera. If you use the 'focus and recompose' technique, be sure your subject understands the need to stay perfectly still during the interval between focusing and exposing the shot.
From a comment by the OP:
Canon 200D, one shot AF with central focus point in viewfinder mode and face tracking mode in live view mode. I do get slightly better results in live view thanks to dual pixel technology but not 100% sharp.
If you're using Live View it is not an AF calibration issue between the lens and the camera. You're either dealing with camera movement, subject movement, or the limits of the lens' incremental AF steps. Movement by the camera or subject between when camera focuses and when you take the picture will result in a change in distance not reflected by a change in focus. Movement during the time the shutter is open (camera, subject, or both) will result in motion blur.
The STM lenses have discrete steps that they move, even when manually focused. There is no way to focus the lens between what we might call "position 5078" and "position 5079". The few non-USM lenses (pre-STM) in Canon's lineup are similar with AF (as of a couple of years ago the EF 50mm f/1.8 II had the widest steps between AF positions of any current Canon lens), but can manually be focused via mechanical linkage to any of an infinite number of positions (if you can precisely move that crazy focus ring on the front of the old 50mm f/1.8 II without getting your fingers in the shot). The STM lenses are 'focus-by-wire' and even when you move the focusing ring the stepper motor is what moves the lens elements. (There are also a few USM lenses that are 'focus-by-wire' with discrete minimum steps of movement even when focusing manually).