In Mr. Gillum, voters were presented in many ways with Mr. DeSantis’s opposite. As an elected official in Tallahassee since 23, he embraced liberal positions — like higher corporate tax rates, legalization of marijuana, tighter gun control and Medicare for all — that thrilled the Democratic Party’s activist base. But they also gave Mr. DeSantis more than enough material to portray him as a radical leftist out of step with a quintessential swing state.

But Mr. DeSantis struggled to gain momentum, and he trailed in the polls for much of the campaign after telling Fox News that Florida voters should not “monkey this up” by voting for Mr. Gillum. Critics saw the remark as a racist dog whistle, but Mr. DeSantis, who is white, said he had not intended it as a racial jab.

That was not the only racial episode during the campaign. In August, an Idaho-based white supremacist group placed racist robocalls to Florida voters in which a man claiming to be Mr. Gillum spoke in the exaggerated accent of a minstrel performer while monkeys screamed in the background. Both campaigns denounced the calls, which drew attention to Mr. DeSantis’s earlier gaffe.

The negative attention on Mr. DeSantis’s campaign lifted in the weeks before the election, when he named Susie Wiles, a veteran Republican operative, as his new campaign manager. He worked furiously to define Mr. Gillum as a proponent of “ideological radicalism” and a “George Soros left-wing agenda” who was out of step with the average Floridian.

And he campaigned on a promise to support military veterans, defend a scholarship program that pays private school tuition for low-income students and appoint “constitutionalist” judges to the State Supreme Court, a promise that echoed a similar one made on the campaign trail in 2016 by Mr. Trump.

Mr. Gillum said on Saturday that he remained committed to pushing for societal change — if not as the next governor, then as an advocate.

“Although nobody wanted to be governor more than me, this was not just about an election cycle,” he said. “This was about creating the kind of change in this state that really allows the voices of everyday people to show up again in our government. We know that this fight continues in spite of the outcome of this election.”

At 39, he remains young enough to run again, for the governorship or some other office.

“Stay tuned,” he said. “There will be more to come.”