Congress’s two top tax chairmen warned President Obama on Wednesday not to claim unilateral executive powers to raise taxes on his own, saying it violates the Constitution and ruins chances for a lasting deal.

Rep. Paul Ryan, chairman of the House Ways and Means Committee, and Sen. Orrin G. Hatch, chairman of the Senate Finance Committee, said they were troubled by White House’s announcement earlier this month that Mr. Obama is “very interested” in exploring what options he has to raise taxes without going through Congress.

“This would be a mistake, both constitutionally and politically,” the two lawmakers said, adding that if the president pressed ahead, it would make it much tougher for him to reach a deal with Congress on simplifying the tax code and permanently eliminating tax breaks.

White House press secretary Josh Earnest earlier this month said Mr. Obama is looking for ways to use his executive authority to benefit the middle class, and said the president has asked his “his team to examine the array of executive authorities that are available to him to try to make progress on his goals.”

“The president is very interested in this avenue generally,” Mr. Earnest said — though he added there isn’t any impending announcement.

Mr. Obama’s actions last November on immigration have proved to be a political nightmare, poisoning the president’s hopes of finding common ground with Republicans on a host of issues.

Meanwhile, a federal judge in Texas has ruled that Mr. Obama likely broke the law in taking unilateral action on immigration, and has issued an injunction. The Justice Department has appealed that ruling.