There is a lot less joking these days.

As Mr. Cuomo has made his opposition to Mr. Trump the centerpiece of his Democratic primary campaign for a third term, his verbal and legal assaults on the Republican president have drawn the two into a war of words and offered a blunt preview of what a 2020 presidential campaign featuring two political scrappers from Queens might look like, as implausible as that might seem.

Mr. Cuomo called Mr. Trump “un-American,” a “coward” and tied him to “sexism, racism, bigotry, and intolerance” in just the last week. Mr. Trump mocked Mr. Cuomo’s rumored presidential ambitions — “Please do it. Please,” he said, dripping with sarcasm — and then piled on with a half-dozen tweets after Mr. Cuomo said America “was never that great.”

The attacks and counterattacks mark the first direct confrontation between the two politicians, who rose in the shadows of their fathers, with a long and layered history that stretches back more than three decades. In a glimpse into their shared past, at one point last week Mr. Trump said Mr. Cuomo had privately promised not to run for president against him. (Mr. Cuomo, a day later, denied this.)

“Mr. Trump, I’ve known you for 30 years,” Mr. Cuomo told a mostly black audience in a Brooklyn church on Sunday. “You may be a slick salesman who fooled many people in this country. But you didn’t fool me.”

Mr. Cuomo declined to be interviewed for this article, and the White House did not respond to a request for comment. A spokeswoman for Mr. Cuomo played down Mr. Trump’s taped appearance at Mr. Cuomo’s bachelor party, saying it was “one of 20 cameos” in a “spoof video montage.”