Take public transit from Denver to Boulder, it's your best chance!
The earlier you can book your trip to Boulder, the better. There is usually no need to book these sort of trips from Denver to Boulder in advance. Rideshares should be available on demand all hours of the day. Public transportation prices do not fluctuate like flights. Instead, they're either flat rate or priced by distance traveled. If possible, you can book your tickets via an app or alternatively at the station upon arrival.