Just as senators were closing in on a deal that Republican negotiators said would constitute the most conservative border security bill in decades, Donald Trump was closing in on the G.O.P. presidential nomination.

And his vocal opposition to the compromise, which would also send tens of billions of dollars in aid to Ukraine, now threatens the chances of the entire package in a divided Congress.

Trump’s twin primary victories have forced Republicans to once again fall in line. Now, he is wielding a heavier hand over his party’s agenda in Congress than at any other time since leaving office.

Republicans are “in a quandary,” Mitch McConnell, the Senate minority leader, told his conference in a closed-door meeting on Wednesday, according to lawmakers who attended. What was supposed to be the sweetener for conservatives opposed to sending tens of billions of dollars to Ukraine had become as politically treacherous as the foreign aid itself, he said. Trump’s growing influence was dividing Republicans on an issue that once united the party.