WASHINGTON — He would relish a run against Senator Elizabeth Warren and has dismissed Senator Bernie Sanders as “crazy.” He has worried about Joseph R. Biden Jr.’s standing in the polls, at the same time telling advisers that the former vice president is a male version of Hillary Clinton and that a matchup in 2020 is a race he knows how to run.

But President Trump has been less sure-footed about how he would take on Senator Kamala Harris if she were to be his rival. And after her breakout performance in the Democratic presidential primary debate on Thursday night, Trump campaign aides and allies acknowledged that Ms. Harris, a black former prosecutor from the donor-laden state of California, could prove to be a vexing adversary.

“I would be more worried about Kamala Harris than Joe Biden as the nominee,” Matt Schlapp, the chairman of the American Conservative Union, said after watching the debate. “The Joe Biden of last night is a candidate I would dream to run against. But she can put together the Obama coalition. She’s also a first, and Democrats like the tingles up the leg.”

In one lacerating rebuke of Mr. Biden on Thursday night, a man two decades her senior who has held some of the most powerful posts in American government, Ms. Harris altered two perceptions about the 2020 election. She gave an audience of millions a preview of how she could be a nimble opponent in a televised face-off with Mr. Trump. And she chipped away at some of Mr. Biden’s aura of dominance in the Democratic field.