Congress may be on the verge of striking a long-awaited deal on immigration reform when it returns to work after the Memorial Day recess, but lawmakers caution that a final compromise is far from assured.

Democratic Senate leaders pledge to take up a bipartisan compromise authored by the Gang of Eight senators in June. But a separate bipartisan group is crafting a House version of the bill that House Minority Leader Nancy Pelosi, D-Calif., said could be merged with the Senate version before Congress' summer recess in August.

"We are optimistic about the prospects," Pelosi said.

House Speaker John Boehner, R-Ohio, said he is "confident that we'll have a solid work product that we can go to conference with the Senate."

House lawmakers working on their own immigration bill were buoyed last week when the Senate Judiciary Committee backed the Senate plan by a wide margin. The Senate bill couples new border security measures with a path to citizenship and instant legalization for illegal immigrants who came to the U.S. before 2012.

After the Senate panel cleared the measure, Minority Leader Mitch McConnell, R-Ky., announced he would not block efforts to bring the bill to the Senate floor.

"I think the Gang of Eight has made a substantial contribution to moving the issue forward," McConnell said. "And so I'm hopeful we'll be able to get a bill that can pass here in the Senate."

The Senate committee's approval also provided "wonderful momentum" for House negotiators, said Rep. Luis Gutierrez, D-Ill., who is helping write the House immigration bill.

Before leaving Thursday for their recess, House negotiators agreed that newly legalized immigrants would not be eligible for Medicaid or insurance subsidies that will become available under President Obama's health care reforms.

"I think the House is going to have its own good bill," said Rep. Lamar Smith, R-Texas.

But even as the House and Senate advance their own versions of the bill, differences between them could ultimately sink the chances for a final compromise.

House Republicans oppose the path to citizenship and immediate legalization the Senate bill would provide. And Smith called the Senate version "fatally flawed," in part because it lacks adequate border security provisions.

Boehner announced last week the House "will not simply take up and accept the bill that is emerging in the Senate if it passes."

The Senate is working on a single comprehensive bill that would deal with legalization, border security and other issues. That could be problematic in the House, where House Judiciary Committee Chairman Bob Goodlatte, R-Va., has been parsing the issue into a series of bills more limited in scope. The House approach allows lawmakers to vote separately on various aspects of reform so they can support some and oppose others.

Goodlatte last week introduced a bill that would increase visas for high-skilled workers and provide green cards to foreign graduates of U.S. universities who have earned degrees in science, technology and engineering.

Goodlatte told The Washington Examiner that he will introduce a bill next week that would bolster enforcement of existing immigration laws.

"Step by step," Goodlatte said, describing his approach. "There are lots of problems with the Senate bill."