Difficulties are Static. Works well in "Bounded Accuracy" 5e, but works in all the other editions too, where the adventurers simply get better at their job. There is nothing wrong with encountering a DC 30 lock the 1st level rogue can't pick, or the DC 10 "lock" the 10th level rogue sneezes at and unlocks.
Monsters... I believe in a campaign design where the foes are what they are, based on the story and location, not when the PCs encounter them. For the current campaign, I put the red dragon on the "starting map" - far to the southwest, but known location. When the party wandered into a goblin warrior training camp at 8th level, they fought... well, some slightly boosted goblins (it was a training camp, after all), but the gobbos ranged from CR 1/4 (new recruits) to CR 2 (elite goblin assassin teachers). Plus the delivery ogre. At 9th level, for reasons, they hunted down a cult near the capital and fought CR 1/2 and CR 2 cultists, and a pair of "Cultist Fanatics" with 2 extra abilities (CR 3)... plus teh CR 5 wraith of the previous agent sent to deal with it. But at 5th level, the PCs also fought a family of Purple Worms (CR 2, CR 5, and CR 11!); at 7th one of their encounters was a Thieves' Guild with level 3 thieves... and a few days later a CR 10 death dragon and the zombie plague it caused (because it had tracked them down from looting a claw from its mortal corpse weeks earlier). At 4th level, the party lost several horses and nearly TPK'd because they wandered into a Stone Giant ambush in the mountains where the earlier dwarven patrol said "we've lost many soldiers to giants recently".
Now, that's a "sandbox campaign". The previous campaign wasn't nearly as CR-swingy; the party's mentors (at Low Tier) and allies (at Mid-Tier) sent them after challenges that should be achievable, if dangerous. No need to waste excellent agents on easy targets, but likewise, no throwing away good agents on lethal foes (unless there was no other choice - and then, generally, the PCs were aware of the risk). But I ALWAYS subscribe to - and make sure the players know in Session 0! - the rule "KNOW WHEN TO RUN". I don't pull punches or fudge dice (although I do give "Luck Points" for showing up to the game on time)! Don't assume that I put a defeatable foe in front of you - no one has Plot Armor!