Look up circadian rhythm sleep disorders, non-24-hour sleep–wake disorder, delayed sleep phase disorder, free running sleep.
Our bodies respond strongly to food and light and caffeine. Food when you wake up, and darkness as you're going to sleep.
Remember that caffeine has a half-life of up to 9 hours, so if you're having trouble winding down at bedtime, that might be attributable to the cup of coffee or soda you had at lunchtime.
Half-life might be such and such, but people who drink a coffee after dinner for 20 years sleep better than non-coffee-drinkers who have an espresso after lunch that one time.
I drink roughly a pot of coffee a day. Keeps me in the game.
Just one more at dinner is not going to keep me awake at night. Maybe another pot, but that's still a maybe.
Not speculation *up to* 9 hours. Your Mileage Will Vary. My point was for people who aren't sleeping well, who should be extra aware of the stimulants they're taking and how long they can be active.
4-6 hours is also pretty long, which means there aren't very many lambdas between that afternoon cup and when you're trying to go to bed.