Nowhere is that clearer than in the Southwest, where growing diversity and Mr. Trump’s demeaning rhetoric about Latino migrants are pulling parts of the region from the once-firm grip of Republicans.

In addition to Ms. Torres Small’s district, Democrats flipped a House seat in the midterms on the southern border in Arizona and four seats in rapidly diversifying Orange County in Southern California.

In Arizona, Kyrsten Sinema, a Democrat, captured a Republican-held Senate seat, while in Texas the Democratic Senate nominee, Beto O’Rourke, came closer to winning a major statewide race than any other Democrat in 20 years. Ms. Sinema won 69 percent of Latino voters and Mr. O’Rourke 64 percent, according to exit polls.

Each of the nine House members whose districts touch the border from California to Texas opposes a wall as the wrong solution for border security.