Back in the day.... when I was working at newspapers... we used actual "masks" made of amberlith and rubylith to "drop out" backgrounds and do other modifications to images and graphics. Those were sort of like a plastic film, colored orange or red, which was semi-transparent. We'd use an Xacto knife to cup away and remove the portion we wanted to see, leaving the "mask" covering the portion of the image we wanted to disappear. Amberlith and rubylith came in sheets and rolls of tape in various widths. There were adhesive and non-adhesive versions.
Now it's much easier in Photoshop... you create a layer and add a mask to it... then use a "black" brush (or other tool) to "paint away" the portion where you want the base layer to show through. You also can use a "white" brush to paint it back if you make a mistake or change your mind (much easier than having to repair a mis-cut amberlith).
The top layer, with the mask, can be used for any number of different things. You can replace a background, add blur, do selective sharpening, apply different amounts of noise reduction to different parts of images, add a color correction filter to part of an image, and much more.
You can even create "gradations" with it, such as to make a faux depth of field effect where the background is gradually more blurred the farther it is behind the subject. The way I usually do that is to first use a 100% black brush to erase the layer, then switch to a 10 or 15% white brush and make repeated passes to "build back up" the effect, creating the gradation. Different size and different "harness" brushes can be used.
Once you learn to use masks, you'll have a very powerful tool at your disposal!
Here's an example where I used a mask to "correct" part of the image. This was a subject in a shaded location, in front of a very bright, sunlit background.... way more dynamic range than any camera can handle in a single image. Plus it was a moving subject, so I could only take a single image (couldn't use "HDR" or "high dynamic range" multiple image technique). So I shot the image RAW and "double processed" it... I made one version with both exposure and and white balance adjusted for the primary subject, indoors and shaded.... Then I made a second version of the image adjusted to recover some of the outdoor, sunlit background.... adjusting both exposure and white balance. Then I made a copy of the one image and placed it on top of the other as a new layer in Photoshop, created a mask on it and "painted away" the portion where I wanted the subject to show through... basically combining the "correct" portions of each image. In the end, I actually made the top (background) layer a little transparent, to look a bit more natural. (Note: the entire image has a bit of extra saturation due to the printing process that was going to be used.) Once it all looked right, I "flattened" the layers into a single image. That's necessary to be able to save the image as an 8-bit JPEG (if wanting to save an image with work still needing to be done, an image can be left in layers and saved as a 16-bit TIFF or PSD file).
Left is the version adjusted for foreground/shaded subject (bottom/main layer)... center is the background/sunlit version (top/masked layer)... right is the finished image combining portions of the other two, using layers and masks. I use layers and masks A LOT for all sorts of selective work.