NASHUA, N.H. — The question was the same: Why should you be the Democratic nominee for president?

The answers helped illustrate why Beto O’Rourke is stalling and Pete Buttigieg is surging in the first months of the campaign.

“So, for whatever reason, the president has trained the focus of this country on the border, on immigrants, on asylum seekers, on our connection with the rest of the world,” Mr. O’Rourke, a former Texas congressman, told a reporter last week after meeting with New Hampshire voters at a coffee shop near the Maine state line. “That’s where I live, that’s where I’m raising my kids, that’s the community I represented, those are the stories that I can tell that are profoundly positive and part of the larger conversation in this country, the larger story of America.”

A few hours later, speaking to employees at a yogurt company closer to the Massachusetts border, Mr. Buttigieg made his case.

“Americans tend to look for the opposite of what we just had,” he said, citing the Democratic strategist David Axelrod’s maxim that voters seek a “remedy, not replica” of the incumbent president. “Sometimes we feel tempted to try to just put up the mirror image of what’s there. I think what we need is something that’s completely different. If nothing else, I’m completely different than this president.”