If one has a 5-hour layover in Denver, is there enough time to go to the city and wander around for some time? Or is there a better way to spend those 5 hours? The flight is domestic.
Not much. You'll have to take a train (RTD A line) to downtown (Union Station). It is about a 40 minute trip with trains at intervals of 15 or 30 minutes depending on the time of day. Plus, it takes some time to get from your gate to the train station (there is an underground people mover). On the return, you'll have to allow time to go through security, which can be long. Also, I'm not sure that there is any place to store your luggage during the journey. (There are conflicting reports online as to whether storage is available; I've never checked it out myself.)
Taxi or car would not be very much faster, and a lot more expensive.
I think you'd be lucky to be able to spend 1 hour in the vicinity of Union Station. It's a moderately interesting city center, but I don't think there is anything really iconic that you'd be able to do or see in that time.
If you stay within the airport (airside), there is a fairly good selection of food, drinks, etc, including some bars with local beer. Note that you can move between the A,B,C concourses via the underground people mover (but don't go to the "terminal / ground transportation / baggage claim" stop, as you will find yourself landside and have to go back through security). The airport has free wifi which is pretty fast, and you can usually find a quiet place to sit (I like the upstairs waiting area of the C concourse). You can get some exercise by walking the long concourses - the B concourse is nearly a mile from end to end and must surely be one of the longest buildings in the US.