When people talk about challenging the players, a lot of what I tend to see is people building one object to challenge them. It is a big boss creature with special counters to the PCs general modus operandi. Essentially, they are creating a tank or a hammer to use to pound in the problem player(s) for whatever infraction they see, whether it be ‘This player is making challenges extremely simple’ to ‘This player is exploiting a rule’ or whatever.
However, if you want to challenge them on a consistent basis, you can do it in a different way, by using Interdependence Risk. In business, interdependence risk comes from the fact that since everything is now connected, a small event like a trader improperly covering derivatives trades, a rogue computer hacker, a fire in a supplier’s factory can spiral into a much larger company-threatening crisis. There are many ways to apply this to an RPG, but in the end, everything is connected and needs to be working to make the whole work. Look at your traditional team in a D&D setting; fighter, healer, magic-user and thief. They all must work together or there is some problems, as is illustrated by this Order of the Stick comic:
When Belkar decides to walk away from his duties for kills he is causing an Interdependance Risk as the enemies then go after the spell casters, something Belkar references how it should be an easy thing to do.
So, to challenge players you want to develop situations where you can then have your players challenged in small ways that can then build into bigger challenges. An old module was White Plume Mountain which had a section with platforms suspended above geysers that would go off a d spray the people on the platforms. Some people would also add other things, like monsters that would attack the first across the chasm, meaning it can be quite deadly for the players since it would be a surprise attack.
In that example, it took a few small bits and combined them together to create a possibility for a dangerous scenario. A tunnel collapse splitting the players is another example of a small thing causing larger problems since now the party is split, and if done right could mean things like healers on one side and fighters on the other, or maybe light source on one and people who need it in the dark. Add some traps or Tucker’s Kobolds guerrilla hit and run tactics to make the game even more challenging.
Terrain can hamper movement speed, range of motion, cover/visibility, height differences, as well as being it’s own inconveniences like traps, loose items that can be thrown or set ablaze as examples. A statue gets knocked over could be an obstacle to move past or it could do damage to whoever’s in its path. Meanwhile, while the players are dealing with the statue, the enemies are getting further away or otherwise furthering their plans.
Environment, NPC actions or inactions, monsters, simple passage of time, all of the smaller elements can be used to increase a challenge as they make things harder. Does the guard stop the players from going somewhere? The villain could be using that time to further their goal, be it killing, cleaning up the evidence, or something else. Perhaps the PCs need to have a key witness get to court by a certain time but a traffic accident makes them late, well there goes their court case and if you have double jeopardy laws they cannot be tried for the same crime, so a simple delaying tactic caused the villain to essentially be vindicated, so now something else needs to be done to stop them.