In Season 4, Episode 13 of The Walking Dead, there was a scene at the very end where Daryl and Glenn step out of a car. Daryl and Glenn haven't seen each other all season. Was that some kind of dream sequence, or was it foreshadowing? And if it was foreshadowing, it was actually set in the future which kind of screws up the timeline a little, as the episodes would be out of order. I'm thoroughly confused...
I believe you're referring to S04E13: Alone, though Daryl and Glenn encounter Bob Stookey at the beginning of the episode, not the end.
This was a flashback to when they first met Bob who had been surviving alone for a while.
Thematically, this was to bookend our characters being "Alone". We begin by meeting Bob when he is wandering alone, and we close with Daryl finding himself alone after Beth is kidnapped.