Relationships were forged slowly and in unlikely places. Although Mr. Durbin and Mr. Rubio were already friends as part of the 6 a.m. crowd in the Senate gym, Mr. McCain and Mr. Schumer had never had a strong relationship, despite having overlapped in the Senate for more than a decade.

“Getting McCain back into the game — he was a little leery about Schumer,” Mr. Graham said.

But the two men managed to bond. During a trip to the Arizona border with some of the group members, Mr. McCain came down with food poisoning and had to cancel immigration meetings he had scheduled later that day. Mr. Schumer filled in as he made himself at home in Mr. McCain’s Phoenix office (he ate jelly beans from the jar on Mr. McCain’s desk) and told groups in Arizona to trust their senator.

“You need to have McCain’s back,” Mr. Schumer said. “He is being really brave here, and doing the right thing.”

The border trip took place over Passover. So Mr. McCain presented Mr. Schumer, who is Jewish, with chocolate-covered matzo.