I want to set up a world where there are designated building and mining areas, but I don't know how to do this. Do I need a mod or plugin, or can I just use commands? If so, what do I need to do specifically?
Some of this can be done with commands but it is highly recommended that you use plugins if this is going to be on a server with more people.
Plugins give you the ability to precisely define protected areas and stop block-breaking or block-placement from even happening by cancelling the event on the server-side. Commands, on the other hand, use tricky methods such as switching your gamemode or giving you mining fatigue which is not very reliable.
If you do decide to use commands, here is how to set up an area where players can't break blocks. Place down a repeating command block and set it to always active. Then, paste this command in it:
/effect give @a[x=,y=,z=,dx=,dy=,dz=] mining fatigue 1 0 true
x,y and z are the coordinates of a corner of that area and dx,dy and dz is the width, height and length of that area. For example, x=10, y=10, z=10 with dx=5, dy=5, dz=5 will result in an area being defined between coordinates 10,10,10 and 15,15,15.
once the player leaves the area, the effect will wear off in a second or two. Also, because the player has a 5 block reach, I suggest expanding the area 5 blocks more than it has to be to compensate for that reach.