But Mr. Bloomberg began linking himself more closely with Democrats after Mr. Trump was nominated for president, giving a speech at the Democratic convention in Philadelphia endorsing Hillary Clinton. He has repeatedly rebuked Mr. Trump since the inauguration, calling the Republican tax-cut law a “trillion-dollar blunder” and becoming a United Nations envoy on climate after Mr. Trump announced plans to withdraw the United States from the Paris agreement on emissions.

[Here’s what’s coming up next on the primary calendar.]

Mr. Bloomberg’s political team is in frequent contact with Democratic leaders, including some he has relationships from his time as mayor, and with liberal-leaning advocacy groups like Emily’s List that he is likely to collaborate with in the 2018 campaign. He has conferred regularly with Representative Joseph Crowley, of Queens, who is the fourth-ranking Democrat in the House, as well as Representative Seth Moulton of Massachusetts, a 39-year-old military veteran who has emerged as a leading critic of Nancy Pelosi, the minority leader.

Mr. Bloomberg is said to be intrigued by a list of candidates Mr. Moulton has endorsed, many of them also veterans.

“Especially in these marginal suburban districts, he’s someone whose resources and credibility can help candidates in tough races,” Mr. Moulton said, adding that Mr. Bloomberg would likely be cautious about where to deploy his operation: “There are places where you want to go in very obviously, and other places where you want to do work behind the scenes.”

Mr. Crowley said in an interview that Mr. Bloomberg had expressed dismay to him about Republican lawmakers’ refusal to challenge Mr. Trump.

“He recognizes the threat of this presidency,” Mr. Crowley said.

Mr. Bloomberg will likely support Republicans in a few races for governor this year, and he donated $5,400 in April to Representative Dan Donovan, a Staten Island Republican battling a primary challenge from Michael Grimm, a former congressman who was jailed for tax evasion. Beyond that, Mr. Bloomberg is expected to spend little or nothing on Republicans at the federal level, his advisers said.

Mr. Bloomberg’s partisan loyalties have shifted repeatedly over the years: He was a registered Democrat before switching parties to be elected mayor in 2001, and hosted the Republican convention in New York in 2004 before leaving that party to become an independent three years later. He twice made serious preparations to run for president as an independent, in 2008 and 2016, but both times ultimately decided against it.