The televised event in Miami took place just days before the next round of primaries, including Florida.
With 246 delegates at stake, the southern state is the biggest prize.
Mr Sanders had a surprise victory in Michigan on Tuesday, but Hillary Clinton increased her overall lead with a big win in Mississippi.
In the Republican race on the same day, Donald Trump won three more states (Michigan, Mississippi and Hawaii) in his bid to win the Republican nomination. Ted Cruz won a Republican-only race in Idaho.
The states were the latest to choose candidates to compete in November's presidential election.
Sanders rides Michigan wave at Florida debate
US media: Has Sanders changed Democratic race?
What will Americans do if Trump wins?
Election results - as they come in
During the Miami debate, former Secretary of State Mrs Clinton criticised Vermont Senator Mr Sanders for voting against an immigration reform back in 2007.
"Just think, imagine where we would be today if we had achieved comprehensive immigration reform nine years ago," she said.
Mr Sanders responded by saying he had concerns about the treatment of guest workers. The proposed programme was "akin to slavery", he said.
He also said that Mrs Clinton was against allowing illegal immigrants to obtain driver's licences.
It's been only three days since their last debate, but all it took for the political fortunes in the Democratic presidential race to change dramatically was one day of voting in Michigan.
Thanks to Bernie Sanders' shocking - albeit narrow - upset win in that state's primary on Tuesday, Hillary Clinton went from exuding confidence on Sunday night in Flint to acknowledging on Wednesday evening in Miami that she's "not a natural politician".
Mr Sanders, with a new lease on political life, went on the attack early against the former secretary of state. He implied that she had something to hide by not releasing transcripts of paid speeches to Wall Street firms and that she is in the pocket of big business.
The Vermont senator did find himself on the defensive when the topic turned to his past praise for communist governments in Cuba and Nicaragua, but the story of the night was how Mrs Clinton handled her recent adversity. Often she has seemed most sympathetic when showing vulnerability.
Now the waiting game begins. Can Mr Sanders build on his Michigan win next Tuesday when Florida, Ohio and several other states vote?
Those results will go a long way in determining whether Michigan was a blip or the start of a prolonged Sanders surge.
Nearly two million Hispanics live in Florida, and their support will play a big role in the 15 March primary.
Florida is home to nearly 1.8 million Hispanics, including about 15% of the state's Democrats.
The two rivals also discussed job creation, education and climate change.
And they both attacked Mr Trump, with Mrs Clinton saying that his "trafficking in prejudice and paranoia has no place in our political system".
She said Mr Trump could not even decide "whether to disavow Ku Klux Klan".
Meanwhile, Mr Sanders said: "I think that the American people are never going to elect a president who insults Mexicans, who insults Muslims, who insults women, who insults African-Americans."
15 March: Florida, Illinois, Missouri, North Carolina, Ohio Primaries
22 March: Arizona Primary, Utah Caucuses, Idaho Caucuses (Democratic)
26 March: Alaska, Hawaii, Washington Caucuses (Democratic)
1 April: North Dakota Caucuses (Republican)
5 April: Wisconsin Primary
9 April: Wyoming Caucuses (Democratic)
19 April: New York Primary
Democratic Party presidential hopefuls Hillary Clinton and Bernie Sanders have sparred over immigration and other issues during a debate in Florida.