After gaining notice for his recurring role as Doug the Dog Guy in the NBC television program Providence, Cavanagh was cast as the title character in the NBC program Ed. Cavanagh received a Golden Globe nomination and a TV Guide Award for his work on Ed, which ran for four seasons beginning in October 2000 and concluding in February 2004.
Cavanagh guest starred on the sitcom Scrubs where he played Dan Dorian, the brother of Zach Braff's character. He made six subsequent appearances in the series, starting with 2002's "My Big Brother" and culminating with the eighth season finale.
In 2005, Cavanagh filmed the pilot Love Monkey, with Jason Priestley, Judy Greer and Larenz Tate. The show was selected by CBS as a midseason replacement and debuted on January 17, 2006. Love Monkey was given an eight-episode order, but only three aired on CBS before the show was placed on indefinite hiatus due to low ratings. VH1 bought all eight episodes which was played in the entirety in the spring of 2006.
He starred in the Lifetime Movie Network television miniseries The Capture of the Green River Killer in which he portrayed King County sheriff David Reichert. In March 2006, Cavanagh filmed My Ex-Life, a comedy pilot for CBS about a divorced couple who remain friends. The pilot featured Lost actress Cynthia Watros as his character's ex-wife. CBS did not select the show for its fall 2006 schedule. Cavanagh portrayed the lead role Nick Snowden (the heir to the Santa Claus identity) in the made-for-TV movie Snow in 2004.
In 2008, Cavanagh appeared in the short-lived ABC series Eli Stone, playing the father of the title character. From January to April 2009, Cavanagh starred in the television drama Trust Me, co-starring Eric McCormack, which aired on TNT until cancellation due to low ratings.
Cavanagh hosted Stories from the Vaults on Smithsonian Networks from 2008 to 2009. He made a guest appearance in the mid-season premiere of the USA Network show Royal Pains as former professional golfer Jack O'Malley. In 2012, he starred in Lifetime's A Killer Among Us remake.
From 2014 to 2021, Cavanagh was a series regular on The CW's live-action television series The Flash, portraying Harrison Wells; most notably Eobard Thawne / Reverse-Flash impersonating the Earth-1 version in conjunction with several different doppelgängers, such as Earth-2's Harry, Earth-19 writer H. R., Earth-221 detective Sherloque, and explorer Nash (also known as Pariah). He was a regular cast member for the first seven seasons, and made guest appearances in the final two. In 2023, Cavanagh began hosting the game show Hey Yahoo!.