“I don’t think that anybody in this campaign has articulated a vision for the future of the country that would not command a majority of voters in November of 2020,” he said. “Their vision for the future of the country is much better and will be more popular than Donald Trump’s.”

The comments came just a day after Mr. Obama spoke at a forum in Washington, D.C., and warned against Democrats moving too far to the left, particularly on issues such as health care and immigration. While Mr. Obama did not mention any candidate by name, he took aim at the “activist wing” of the Democratic Party and “left-leaning Twitter feeds,” saying they were out of touch with the average voter.

“This is still a country that is less revolutionary than it is interested in improvement,” he told an audience of some of the party’s wealthiest donors on Friday evening.

The remarks were a rare departure for Mr. Obama. While the former president has spoken privately with nearly all the candidates, he has been careful to avoid exerting any influence on the race.

Sign up for On Politics to get the latest election and politics news and insights. Sign up for our politics newsletter

Aides said his comments were intended to calm the nerves of Democrats who were worried about the strength of their historically large field, but Mr. Obama ended up reinforcing some of their more pressing concerns.

Some establishment Democrats, elected officials and top donors have fretted that the liberal platforms of Mr. Sanders and Senator Elizabeth Warren would complicate their paths to the general election, arguing that they would lose voters in rural areas and in the suburban districts that helped the party win back the House last year. They are particularly worried about the politics of “Medicare for all,” fearing it could transform health care, an issue that has been a political asset for Democrats, into a liability.

“We’re changing something that clearly is a message that, in 2018, resonated with voters and we’re making the issue about our plan rather than what the president has or has not done,” former Senator Heidi Heitkamp of North Dakota said.