But those are not the only reasons that some Republicans are concluding it is not worth even trying. A toxic environment for Republicans in the House, where partisanship reigns and they are judged as much for their segments on Fox News as any policy effort, has taken a toll on lawmakers who are interested in pursuing legislative compromises.

“As the party reshapes itself, there are some members who aren’t as comfortable there as they were when they first came,” said former Representative Tom Davis, Republican of Virginia, who chaired the party’s congressional campaign arm from 1999 to 2003. “Especially for some of these members who buck the party on occasion, they are finding it a less hospitable place to be.”

Mr. Hurd, a moderate who won re-election in 2018 by only 1,100 votes, spent years trying to craft an immigration deal with Democrats only to see the effort collapse last year in the face of Mr. Trump’s opposition. The president’s style clearly irked Mr. Hurd; he was one of only four Republicans to join Democrats last month in voting to condemn as racist Mr. Trump’s tweets telling four congresswomen of color — all but one of them born in the United States — to “go back” to their countries of origin.

Ms. Roby had also been less than comfortable with the president’s conduct, and seen her career threatened for saying so. Weeks before the 2016 election, after leaked audio surfaced in which Mr. Trump could be heard bragging about grabbing women by their genitals and forcibly kissing them, she said he was “unacceptable as a candidate for president” and that she would not vote for him.

The comments helped earn Ms. Roby four primary challengers last year who argued that she had been disloyal to Mr. Trump, and she toiled to distance herself from her own criticism of the president, saying she supported his agenda. Mr. Trump ultimately endorsed her via Twitter.

For others who are less willing to publicly break with their party, the idea of being forced to embrace or excuse Mr. Trump’s statements and tactics has become increasingly unpalatable.