NEW YORK — It doesn’t matter what President Barack Obama says these days, his listeners are bound to hear two words: Donald Trump.

With his proclivity for dominating the conversation, the Republican presidential nominee is forcing Obama’s final few months to be viewed almost entirely through the prism of campaign politics. As Obama carries out his presidential duties, voters can’t help but wonder what the role would look like if it were inhabited by the brash billionaire.

At the United Nations this week, Trump trailed the president both metaphorically and physically, as world leaders took stock of what a dramatic shift a Trump presidency would mean for American leadership.

The fusion of the campaign with real-world governing was on vivid display Monday when White House and State Department officials mingled in the same Manhattan hotel lobby where Trump’s advisers were gathered as their candidate met upstairs with Egyptian President Abdel-Fattah el-Sissi.

Obama was staying in the hotel, while Trump was using the meeting to try to show his readiness to go head-to-head with a foreign leader. Democrat Hillary Clinton met with the Egyptian at the same hotel earlier in the day.

The next day, Obama’s final speech to the U.N. General Assembly took him on a world tour of global hotspots and areas of progress. Yet social media and news coverage of his address was preoccupied with what he said — or was believed to have said — about Trump. On three occasions in the speech, Obama urged leaders not to put up “walls” around their nations.

“The world is too small for us to simply be able to build a wall and prevent it from affecting our own societies,” Obama said near the end of his speech. Referring to the Zika virus, he said later, “mosquitoes don’t respect walls.”

Though he never mentioned him by name, Obama and his speechwriters were clearly cognizant that the observations were sure to be perceived as pejorative references to Trump. The Republican has built his unlikely campaign around a steadfast promise — mocked by some, hailed by others — to build a border wall and force Mexico to pay for it.

Yet Obama had a deeper message, too, one unrelated to Trump but uniquely suited for an address to the 193-member global body. Across the globe, nations rich and poor are confronting the rise of nationalist, fear-driven sentiment that has led some countries to reflexively seek to retrench behind their own borders.

In Britain, anger about the perceived consequences of regional integration led this year to a stunning vote to exit the European Union. Embedded in that movement were concerns about immigration that have also cropped up in other parts of Europe, not to mention the U.S.

Though Trump and other Americans have raised concerns about accepting Syrian refugees, the issue in the U.S. pales in severity compared to Europe and the Middle East, where millions of refugees have overwhelmed host countries and led to deep resentment of politicians like German Chancellor Angela Merkel who advocated generous refugee resettlement policies.

At the U.N., Obama also urged leaders not to tolerate the stoking of class divisions by those who feel they’ve been left behind by globalization — “a crude populism,” as Obama put it.

To be sure, those transnational concerns are of the same flavor as ones that Trump has found ripe for political exploitation. But Obama isn’t worried about Trump alone: He’s consistently sought to use his perch on the world stage to offer an alternative viewpoint. Obama advocated strongly against Britain’s EU exit, or Brexit, and this week organized a U.N. summit to pressure nations to take more refugees.

Julian Zelizer, a presidential historian at Princeton University, said it’s natural at this late stage of an administration for the president’s words and actions to be taken in the context of the election. He said that’s especially true this year because Trump had built much of his campaign around a rejection of Obama and his policies, from diplomatic engagement to his health care law.

“It’s very, very hard generally for anything he says to be removed from this campaign context, certainly within the United States,” Zelizer said.

On many occasions, Obama has been explicit about the fact that his words are intended specifically about Trump. He’s said questions about the GOP nominee come up in every meeting with a foreign leader, and he’s emphatically declared Trump to be unfit to inhabit his role as commander in chief.

Those direct challenges to Trump are likely to grow more frequent as Obama, over the next six weeks, spends a large portion of his time on the campaign trail rallying for Clinton. At a rally for the Democrat last week in Philadelphia, Obama derided Trump as a callous champion of the uber-rich, and then turned his attention to praising Clinton.