WASHINGTON — An anti-immigration Republican who is a fervent supporter of President Trump announced on Tuesday that he will challenge Senator Bob Casey, Democrat of Pennsylvania, a move that solidifies the president’s stamp on the emerging electoral landscape for 2018.

The announcement by Representative Lou Barletta gives Republicans a relatively well-known challenger to Mr. Casey as the party tries to take advantage of an electoral map that heavily favors Republicans. But it also shows the political headwinds the Republicans face: The party’s base voters remain loyal to the president and his agenda, even as the larger electorate drifts away.

Mr. Trump had urged Mr. Barletta to run, and in jumping into a crowded primary field, the 61-year-old congressman buoyed Republicans from the president’s wing of the party. He announced his candidacy in a three-minute biographical campaign video in which he reprised Mr. Trump’s slogan, pledging to “make Pennsylvania and America great again.”

His entry into the race comes as national Republicans are working feverishly to recruit candidates. So-called Trump Republicans are emerging in states from Florida — where the Republican governor, Rick Scott, is toying with running against Senator Bill Nelson — to Michigan, where the rock musician Robert James Ritchie, better known as Kid Rock, has dropped hints that he will challenge Senator Debbie Stabenow. Mr. Ritchie, along with Sarah Palin and the right-wing rocker Ted Nugent, paid Mr. Trump a memorable visit to the White House.