CIUDAD JUÁREZ, Mexico — Millions of people are leaving their homes across Latin America in numbers not seen in decades, many of them pressing toward the United States.

While migration to the U.S. southern border has always fluctuated, the pandemic and the recession that followed hit Latin America harder than almost anywhere else in the world, plunging millions into hunger, destitution and despair.

A generation of progress against extreme poverty was wiped out. Unemployment hit a two-decade high. Russia’s invasion of Ukraine choked off a key pipeline for grain and fertilizer, triggering a spike in food prices.

Economic shocks were worsened by violence, as conflict between armed groups festered in once relatively peaceful countries and raged in places long accustomed to the terror.

Amid these events, smugglers and migrants alike have pushed powerful social media campaigns, many rife with misinformation, that have encouraged people to migrate to the United States.

This accumulation of grim factors means that when a pandemic-era border restriction known as Title 42 lifts this week, the United States will be confronted with an immigration challenge even more daunting than the one it faced when the measure was first imposed.

“You couldn’t come up with a worse set of facts to leave tens of millions of people with no choice but to move,” said Dan Restrepo, who served as President Barack Obama’s top adviser on Latin America. “It’s inevitable that you’d have massive displacement, it really is a perfect storm.”

For the last three years, the American government has tried to curtail the record flows of people arriving at the U.S. border by using the public-health measure to quickly expel those whose crossed illegally.

However, when Title 42 expires, migrants who enter the country illegally will have the opportunity to apply for asylum, something many were barred from doing during the three years the public-health restriction was in place.

Qualifying won’t be easy — the Biden administration is rolling out new eligibility restrictions — and if the process works as intended, many will still be deported relatively quickly.

But the large flows building in northern Mexico could overwhelm the system, which means more people, especially families and children, may be released into the United States with a notice to appear before an immigration judge.

In some cases, social media is being used to falsely advertise the coming border rule changes as the opening of the floodgates. On TikTok, posts tagged #titulo42 have been viewed more than 96 million times, with one popular post claiming, “May 11: You cannot be deported. Title 42 has come to an end.”

The number of encounters at the border has already risen in recent days, a jump American officials hope will last only a few weeks and then eventually die down.

Many migrants are coming from places like Venezuela, which was suffering one of the worst economic crises in the world before the pandemic. Much of the country sunk further into misery when the coronavirus shut the world down. A mass exit deepened, bringing the total number of Venezuelans who have fled since 2015 to 7.2 million — roughly a quarter of the population.

In Colombia, where worker protections are weak, joblessness reached its highest rate on record. Brazil recorded the second-highest number of Covid deaths worldwide. Immigrants who had already traveled from across Latin America to these two countries were among the first to lose their hold on any hope of a livelihood.

Nicaraguans historically migrated north in relatively small numbers. But inflation, sinking wages and an increasingly authoritarian government have prompted hundreds of thousands to leave in recent years.

Gang violence and homicides exploded in relatively tranquil Ecuador. Haiti got hit by a cholera outbreak, an extreme hunger crisis and warfare between armed criminal groups — all at the same time.

The Darién Gap, a treacherous 70-mile stretch of jungle that connects Central and South America, suddenly became a thoroughfare for people without the visas or money to make the journey any other way.

The United Nations expects as many as 400,000 people to pass through this year, nearly 40 times the yearly average from 2010 through 2020.

Sitting inside pale pink tent on a Colombian beach not far from the jungle last year, Willian Gutiérrez, 31, a welder and bricklayer, said the situation at home in Venezuela had gone from bad to worse. He hadn’t had stable work in years, meals were meager, “and sometimes I stopped eating so they would be able to,” he said, motioning to his children, Ricardo, 5, and Yolayner, 2.

The family lived in a half-built house without electricity in the oil-rich city of Maracaibo, Mr. Gutiérrez’s wife, Johana García, 38, explained. After watching so many friends leave for the United States, she said, they had decided to risk the trek.

They went because the American economy bounced back quickly from the coronavirus and then got hungry for workers.

But they also were told — by human smugglers, relatives and people posting on Facebook, TikTok and WhatsApp — that under President Biden, they could actually cross the border and stay.

Ms. García, who had just enough money to purchase a tent, a headlamp and two bags of bread for the jungle trip, had heard this from Venezuelans who had made it to the United States before her.

“It’s difficult, yes,” they told her, “but it’s possible.”

American border authorities have in fact been regularly using Title 42 to immediately turn back people who enter the country illegally, invoking it more than 2.7 million times since March 2020.

But Mexico only agreed to take in expelled migrants from a handful of countries in the region, forcing the Biden administration to fly others back to their homelands — a slower process constrained by cost, logistics and the fact that some governments have not always accepted expulsion flights from the United States.

“What on paper was in some ways the harshest border policy ever put into effect, like a complete and total ban on entry, never worked like that in practice,” said Aaron Reichlin-Melnick, policy director at the American Immigration Council, a Washington-based immigrant advocacy organization.

Since taking office, according to federal data, the Biden administration has allowed some 1.8 million migrants to stay in the country while awaiting asylum hearings, many of whom turned themselves in after crossing the border. Unknown numbers also entered the country undetected.

“People who want to get to the United States know that it has been an advantageous time to try to get into the country,” said Andrew Selee, the president of the Migration Policy Institute, a nonpartisan research organization. “They calculate their chances of getting in before they go.”

Ana Gabriela Gómez, 28, a pharmacy assistant who made less than $100 a month at home in Caracas, left Venezuela with her two young sons in September. After nine terrible days in the Darién jungle, she heard that Mr. Biden was tightening border restrictions against Venezuelans.

But so many neighbors and friends had gotten through. She didn’t quite believe the president.

“I’m going to go to see it with my own eyes,” she decided. After she got to the U.S. border with her boys, ages 5 and 6, she crossed the Rio Grande at Ciudad Juárez and turned herself in to U.S. Border Patrol agents, who let her through.

She’s now staying in a shelter in Manhattan, and plans to apply for asylum. In her view, the journey was painful, but worth it.

“My goal was to get here,” she said, “but now I have another goal: to work, to get my papers, a good school for the boys.”

In Facebook and WhatsApp groups directed at would-be migrants, a cascade of users have been encouraging migrants to make the trip to the border after the public health measure expires.

“For those who want to know if the border is open,” one person said last week in a Facebook group called Darién Jungle Migrant Survivors, “yes it is.”

Natalie Kitroeff reported from Ciudad Juárez, Mexico, and Julie Turkewitz from Bogotá, Colombia. Eileen Sullivan contributed reporting from El Paso, Texas, and Emiliano Rodríguez Mega from Mexico City.