WASHINGTON—Sen. Bernie Sanders collected $34.5 million in the fourth quarter, outpacing former Vice President Joe Biden, as both Democratic presidential candidates reported a fundraising surge with one month to go until the Iowa caucuses.

While Democrats brace for a costly—and potentially lengthy—primary season, Republican President Trump faces no significant intraparty opposition and continued to amass campaign cash. His campaign said it raised $46 million in the final three months of last year, its best fundraising quarter...