When the House passed the American Health Care Act by a slim margin on Thursday, Republican lawmakers made their way to the White House for a celebration.

President Donald Trump joked with House Speaker Paul Ryan, mocking pundits who said the speaker didn't "have it." Ryan hailed the passage of the legislation he spearheaded successfully — finally, after three tries.

"We've got a lot of work to do, but one thing is now clear: Republicans are committed to keeping our promise to lift the burden of Obamacare from the American people and put in place a better, more patient-centered system," Ryan said.

The celebration might have been premature.

The bill has a long way to go to reach Trump's desk — starting with the Senate, which could present an even more difficult process than the fits and starts the AHCA faced in the House.

A mix of politics and arcane Senate procedure could sink the AHCA — or totally alter what it looks like.

'Viewed with caution'

The AHCA went through multiple different versions before Republican leaders found a coalition of enough moderate and conservative members to join together to pass the bill. But despite amendments offered to the AHCA by the House Republicans to get enough members on board, Republican senators have expressed serious doubts regarding the bill.

Sen. Lindsay Graham, who had been against the original version of the AHCA, conveyed reservation about the final edition, too. Graham tweeted on Wednesday that the bill "should be viewed with caution."

"My primary duty and job is to ensure this bill – if it were to become law – would be beneficial to the people of South Carolina," Graham said in a statement after its passage. "Only after a careful review of the legislation, as well as discussions with the interested stakeholders across South Carolina, will I know the answer to that question. I do know the revised bill is an improvement over the first attempt."

Some rising-star GOP senators, including Ted Cruz of Texas, Rand Paul of Kentucky, and Tom Cotton of Arkansas, all expressed misgivings about the bill during its consideration in the House.

In fact, the Senate appears ready to scrap the AHCA altogether and pass their own version of a healthcare bill. A group of 12 GOP senators, including Majority Leader Mitch McConnell, have begun to work together on separate legislation.

"It was kind of a moot issue if the House wasn't going to be able to pass a bill and now they have, and I'm proud of them for doing it," Senate Majority Whip John Cornyn said. "Now it's up to us to pass a bill 51 senators can agree to."

'They better not change it'

If the Republican senators are able to come up with a way to get a bill past the Senate, that would open up another can of worms. After the House passed its version of the legislation, House members signaled they wouldn't accept many alterations in the Senate — even as Republican senators said they were preparing their own bill.

Rep. David Brat, a member of the conservative House Freedom Caucus who refrained from supporting the AHCA until amendments were added, told USA Today's Eliza Collins he wants to see the AHCA as it stands now to get to Trump's desk.

"None, not at all," Brat said when asked how much change he would accept to the AHCA in the Senate. "It's about time [the Senate] get a dose of medicine. ... They change it one iota ... they better not change it."

Those types of comments, and fundamental disagreements about some of the provisions of the law, don't seem to bode well for its future. If the Senate passes a different bill, House and Senate members will need to form a conference committee to iron out the differences.

"Assuming the conference committee can produce an agreement, would the full House and Senate then agree to their product?" Greg Valliere, chief investment strategist and long-time political analyst at Horizon Investments, wrote in a note to clients Friday. "Not out of the question, but unlikely. The most probable scenario is that a relatively moderate conference committee bill would be unacceptable to the House Freedom Caucus, sending this maddening process back to the drawing board late this year."

Byrd bath

Republicans in the Senate could run into another problem — their chamber's rules.

In order to avoid a Democratic filibuster, the GOP has been using the budget reconciliation process to pass the healthcare bill. That means it would only take a simply majority in the Senate to pass, but it also means it would be subject to a different set of rules.

Among those: the Byrd rule, which requires that all provisions in a bill that goes through the reconciliation process has to deal with the federal budget.

That means various parts of the AHCA, like gutting Obamacare regulations on insurers, could fail to qualify in the Senate.

"The House has an untenable task of trying to craft a bill that will fit through the matrix of the Byrd rule," Republican Rep. Trent Franks said in March, when the original version of the AHCA was released. "It's essentially like trying to force a giraffe through a keyhole. If you get the job done, he looks a little differently on the other side."