Annie Ramirez, left, and Jennifer Ramirez in July preparing to protest an anti-sanctuary-cities bill at the Texas Capitol.

When Republicans in Texas passed a ban on so-called “sanctuary city” policies this spring, they appeared to be feeding on the momentum created by Donald J. Trump, who had made illegal immigration a centerpiece of his campaign. They were not alone. State lawmakers across the country are addressing issues created by immigration.

In the first half of this year, state legislators enacted 133 immigration laws, almost double the 70 passed in 2016, according to a new report from the bipartisan National Conference of State Legislatures.

That spike in activity is the result of a relatively subdued 2016. In the three years before that, states passed as many immigration laws as they have so far this year, if not more.

This year, the legislation touched on a variety of subjects, including budgets, education and two issues Mr. Trump has long focused on: refugees and sanctuary cities, which seek to help or otherwise protect undocumented immigrants from what they…