Guitars are made of wood, an organic material, which is very susceptible to environment changes (humidity and temperature). So, after time passes, the wood may expand or contract, which changes the physical parameters of the guitar.
There are two forces at play: when tuned, the strings exert force pulling the fretboard "up". In most guitars, there's a long screw inside the fretboard, which pulls it "down".
"Tuning" a guitar means that the strings produce the right frequencies when plucked "open" (i.e. no fret pressed). Correct intonation means that the notes are still "in tune" (producing the right frequencies) along the frets of a same string. "Action" is the height between the string and the fret in different places at the fretboard (so, if you want to be precise, you'd say "6th string action at the 12th fret").
Action is mostly a matter of preference - lower means it's easier to fret the notes, higher means the strings ring out more freely, and therefore the notes sustain better. Can't go too low, or you'll start to experience "fretting" - the strings hit neighbor frets while vibrating for a note, producing an unpleasant metallic buzz.
The actual physical parameters which influence intonation and action are basically neck bow/relief and string length (via small metal pieces in the bridge of the guitar which can be moved, if you guitar has them). This is what the luthier (the professional who sets up instruments) interferes with.
This is a general view - some guitars may have additional factors to consider. For example, in floating bridge electric guitars, you'd need to consider the bridge springs tension as well, for they will influence both string action and the whammy bar travel.
The 'screw' that counterbalances the pulling force on the neck exerted by the strings is the "truss rod" which sits inside the neck (on an electric guitar and some acoustics); this rod is adjustable.
This adjustment influences the 'action'. But the 'action' is also set by the bridge saddles' height, which is adjustable. Most often this height is adjustable independently for each string.
Each time the action is changed (raised or lowered), intonation should be adjusted again, accordingly.
It sounds very complex but it isn't, it just takes a bit of patience and experience (for making a good judgement of what an ideal action would be).
To be honest, much more laborious and difficult is to tune a drum set so it sounds great. There are more adjustment points...
I also second the opinion that it's quite approachable if you're patient and methodical.
Another tip (to _keep_ the setup working) would be to have the guitar professionally set up, then carefully measuring and writing down the parameters, so they can be reproduced later.
The hardest one is neck relief, but even this can be approached in a reproducible way by pressing the first and last frets on a string and measuring space left at the 12th fret with a "feeler gauge" or some other width reference (credit cards, stacked sheets of paper, etc).
A good setup should also make sure the tuners are moving freely and accurately, that no more substantial repairs are needed (fretwork or major neck adjustments), etc. For a beginning player, these differences can be hard to discern, but they do help. For an advanced player, a poorly set up guitar is a pain in the butt to play.
Acoustic set up can also include filing down the nut slots to make it easier to fret. The issue is that a mistake is not as easy to reverse as a truss rod adjustment. If one is not willing to do a DIY nut replacement[1], you'd have to pay a repair shop ~$100 to fix the mistake. Same pitfalls can happen if one tries to polish frets with steel wool and gets over aggressive causing unwanted buzzing.
Electric guitars set up will include individual string intonation, string heights, tension on springs if it's a floating whammy bar, pickup height, etc. It has more hardware machinery to tweak.
https://www.google.com/search?q=acoustic+guitar+nut+replacem...
You grab a guitar off the shelf and you can find it has buzzes, or the action is a bit high, or it sounds right open and with chords near the nut but sounds off as you move up the neck.
I always thought my string buzz issues were due to my inexperience but since getting the guitar back, I haven't had anywhere near the problems with fret buzz.