Chief Justice John G. Roberts Jr. got an earful about President Trump while presiding over his impeachment trial and received a few words from the man himself Tuesday night at the State of the Union address.

The trial may be over, but these two are hardly done with each other.

Currently, the chief justice is either writing or reviewing the Supreme Court’s decision on whether Trump acted within his power to end the program ­protecting young immigrant “dreamers” from deportation. A decision could come at any time before the court’s term concludes at the end of June.

Next month, Roberts will call the court to order to consider whether Trump may shield his personal financial information from a congressional committee and a New York prosecutor each investigating matters beyond the president’s impeachment.

The case ensures that controversies over investigations into Trump’s conduct will continue into the heart of the presidential election campaign.

And on and on it will go.

Trump’s expansive view of his powers has met an unprecedented legal pushback from Democrats and civil rights organizations, and the president’s lawyers have not hesitated to run quickly to the conservative Supreme Court, which they see as a counterbalance to liberal federal judges.

Even as Roberts presided one day at the impeachment trial, the Supreme Court on a 5-to-4 vote granted an emergency request allowing the Trump administration to begin implementing new rules making it easier to deny immigrants residency or admission to the United States because they have used or might use public-assistance programs.

Roberts, who marked his 65th birthday attempting to “carry out ill-defined responsibilities in an unfamiliar setting,” invited lawmakers to visit, saying the front row of the court is always reserved for members of Congress “who might want to drop by to see an argument or to escape one.”

He emphasized that “we carry out our common commitment to the Constitution through the distinct roles assigned to us by that charter.” It was in line with the genial and neutral persona he tried to develop as the bitter, partisan fight was waged before him.

“If nothing else was clear from the last week or so,” said Stephen Vladeck, a law professor at the University of Texas, “it’s that he has one of the best poker faces in Washington.”

That look was on display in the House chamber Tuesday night as Trump stopped to speak with Roberts on his way to deliver the State of the Union speech. A court spokeswoman declined on Roberts’s behalf to reveal what Trump said, but Roberts responded with three nods of the head and a terse “thank you.”

Anyone familiar with how Roberts has carried out his role as chief justice knew he would try not to emerge as a central figure in the impeachment proceedings.

Liberals criticized his passive approach, but in his most substantive statement during the trial, Roberts made clear he saw impeachment as a political event involving the elected branches.

He was spared from being called upon to break a tie on whether to call witnesses. But he made clear later he would not have voted.

Reminded last Friday night by Senate Minority Leader Charles E. Schumer (D-N.Y.) that Chief Justice Salmon Chase had broken ties during the 1868 impeachment trial of President Andrew Johnson, Roberts said he had done the research.

“One concerned a motion to adjourn, the other concerned a motion to close deliberations,” Roberts said. “I do not regard those isolated episodes 150 years ago as sufficient to support a general authority to break ties.”

He added: “If the members of this body, elected by the people and accountable to them, divide equally on a motion, the normal rule is that the motion fails. I think it would be inappropriate for me, an unelected official from a different branch of government, to assert the power to change that result so that the motion would succeed.”

Roberts’s only real intrusion in the trial was twice refusing to relay questions from Sen. Rand Paul (R-Ky.) that would have revealed the name of the whistleblower whose allegations powered the impeachment inquiry.

But the investigations are hardly over, and the Supreme Court will play a pivotal role.

House Democrats are pressing ahead in pending court battles with the Trump administration over witnesses and evidence as part of their “ongoing inquiry” into the president’s conduct.

The federal appeals court in Washington could rule at any time in a pair of separation-of-powers cases over subpoenas for testimony from former White House counsel Donald McGahn and secret grand jury evidence gathered by special counsel Robert S. Mueller III during his investigation of Russia’s interference in the 2016 election.

House general counsel Douglas Letter told the court that investigators are examining whether Trump lied in his written responses to questions from ­Mueller.

In a third pending case, the chairman of the House tax-writing committee sued the ­treasury secretary and the head of the Internal Revenue Service after the agencies refused to comply with subpoenas for the president’s tax returns. The judge has delayed ruling in the matter until the appeals court has resolved the cases over McGahn’s testimony and the grand jury evidence House Democrats seek.

But already on the docket are Trump v. Mazars, Trump v. Deutsche Bank and Trump v. Vance, cases that could result in landmark rulings on a president’s immunity from investigation while he is in office.

Manhattan District Attorney Cyrus Vance Jr. and three Democratic-led congressional committees have won lower-court decisions granting their subpoenas for a broad range of Trump’s financial records relating to him personally, his family and his businesses.

Unlike other modern presidents and presidential candidates, Trump has not released his tax returns. He and his personal lawyers have mounted a vigorous effort to keep that information private and defeat attempts to obtain the records from financial institutions and his accounting firm.

“The subpoena cases may not end up as 5-4, but even before the impeachment trial, I think it stood to reason that the chief justice would be the central figure in them,” Vladeck said.

“Whether sitting through those presentations and machinations have affected his thinking is a fascinating question; I’m just not sure we’ll have any sense of the answer until the rulings come out.”

Ann E. Marimow contributed to this report.