But when you have the aperture set to f/2.8 the distance between the two points drastically reduces. When you are shooting a subject 60cm from the camera, the depth of field is only 4cm, as opposed to 1.3m when you were shooting at f/22

If you want to have a narrow Depth of Field, bring your subject closer to the camera.

If you want to have a deep depth of field, move your subject further away from the camera.

Hyperfocal

Because the Depth of Field is a fixed width on an exponential focal plane inherently you will get approximately ⅓ of the distance in front of the focal point in focus and ⅔ of the distance behind the focal point in focus. If you know exactly how much distance you have in front and behind you can focus slightly in front of the focal point, or slightly behind to increase or decrease the Depth of Field in an image.

For example, if you wanted to maximise your Depth of Field to include infinity, you can focus forward of infinity to include infinity at the end of your Depth of Field, not in the middle and bring closer your hyperfocal distance. Without same 50mm example from before, you can set you camera at 30m at f/2.8 and get everything from 15m to infinity in focus. At f/8 if you set the focus to 10m everything from 5.1m until infinity would be in focus. At f/22 if you set your camera’s focus at 6m, everything from 3m to infinity would be in focus.