Today we’ll see how to use the mask brush in sculpting. I’ll be using the 2.81 version of Blender.
Suppose we want to sculpt only one portion of our mesh so that the surrounding parts are not affected. We can achieve that by using the mask brush.
Let’s create a simple planet with a mountain range on its surface and then sculpt the surface of the area surrounding the range first and then the surface inside the mountain range. Let’s start by deleting the default cube and creating a UV sphere. Scale the sphere: S 10 and add the subdivision surface modifier with 3 subdivisions. Apply the modifier. This is going to be our planet.

Go to sculpt mode and select the mask brush. Turn off mirroring. Use the brush to mask the area which should not be affected by sculpting.

Use the draw brush to sculpt the area around the mountain range. Try to sculpt the masked area as well. As you can see, it doesn’t work.

Now invert the mask (Ctrl+I or in the mask menu) so that you can sculpt the surface inside the mountain range without affecting the surrounding area.

Set the brush radius to 25 and sculpt inside the crater. Try to sculpt outside the mountain range as well.

Finally clear the mask (Alt+M or in the mask menu).

Here’s the video version: