WASHINGTON—The Democratic-controlled House came up short Tuesday in an effort to override President Trump’s veto of a measure aimed at rolling back his declaration of a national emergency.

The 248-181 vote, which didn’t clear the two-thirds threshold, was the coda of a long struggle between Congress and Mr. Trump over funding the wall along the border with Mexico.

Both...