The episode is "Phineas and Ferb's Quantum Boogaloo" (Season 3, Episode 15). Phineas and Ferb build a time machine; Candace accidentally travels 20 years into the future, returns to the present, and becomes convinced her brothers have been replaced by alien impostors. The resulting paranoia drives a hilarious, twist-filled adventure that plays with the show's trademark meta-humor.