The closer the object is to the camera, the shorter the "focal
distance". The depth of field gets shallower as the focal length
decreases, up until the lens has reached its minimum focusing
distance (closer than that and the image will be blurry).
If you photograph something at F1.8 that is 5 feet away, your
depth of field (area in focus) might be 3 feet (1.5 feet each side
of focal point), where if you took a shot at F1.8 but 30 feet away
from your subject, the depth of field could be 20 feet (10 feet
each side of focal point). I've made up these numbers, but there
are charts you can use to calculate DoF based on focal length and
aperture.