If 2022 ended right now, the near 25% decline in the benchmark S&P 500 index would be its worst annual loss since 2008, when the Great Recession was in full force.

The current decline is a little different because it's being driven by a range of factors like high inflation, rising interest rates, and geopolitical tensions in Europe that have combined to dampen investor sentiment. But it's not the first time the market has grappled with such issues, and in the long term, they tend to be resolved. Should investors use this downturn as a buying opportunity?

The answer is: Yes, but be selective.

Uber Technologies (UBER -0.38%) and DoorDash (DASH 3.12%) are two gig-economy companies currently facing the same issue: The U.S. Department of Labor is proposing to reclassify contract workers as employees, which could force Uber and DoorDash to offer healthcare benefits, overtime pay, and other benefits. Doing so would drive their costs up. 

But that's just part of the story. Beyond this news, here's why Uber's stock is a buy, and DoorDash stock might be worth avoiding. 

The stock to buy: Uber

Uber is best known for revolutionizing human mobility, and severely disrupting the taxi industry in the process. The company had to adapt during the pandemic as society went into lockdown and most office-based employees worked from home, leaving far fewer people out hailing rides. 

The worst part of the pandemic was a boom time for Uber's popular food delivery service, Uber Eats, which became one of the only ways consumers could still enjoy their favorite restaurants. Uber's operational diversity is a big part of its success, with mobility, delivery, and freight now forming three prongs of its business model. 

Now that most pandemic restrictions are lifted, Uber's mobility segment is back to generating record numbers, with gross bookings soaring by 55% year over year in the recent second quarter of 2022 (ended June 30). Mobility will likely be Uber's largest business unit once again by the conclusion of 2022, reclaiming the title from delivery, which temporarily took charge on the back of COVID-19.

Uber now has 122 million platform customers, its highest number ever, and reported record total gross bookings of $29 billion during the second quarter. Those results led to $14.9 billion in revenue in the first six months of 2022, more than doubling year over year. But the real story is that Uber appears to be on the cusp of profitability, generating positive free cash flow in the second quarter for the first time ever.

The new proposed rules from the Department of Labor could push the company's costs higher, but there's no denying Uber's trajectory, so its stock is still highly attractive for the long term

The stock to avoid: DoorDash

DoorDash is primarily a food delivery platform, and it competes directly with Uber Eats. DoorDash is ranked No. 1 in the U.S. on food deliveries with a market share of about 59%.

You might be wondering, then, why DoorDash stock is a sell when I've just finished saying Uber is a buy. There are several reasons: DoorDash lacks the operational diversity and multiple revenue streams that Uber has, it's a long way from profitability, and its growth slowed significantly across several metrics.

As a result, and despite DoorDash's industry dominance, its stock declined by a whopping 82% from its all-time high. 

During the recent second quarter of 2022 (ended June 30), DoorDash customers placed a total of 426 million orders on the platform, which represented 23% growth compared to the second quarter of 2021. But in that year-ago period, the same metric grew by 69%, so the rate of increase slowed dramatically. 

This triggered a similar slowdown in the company's gross order value, and therefore its revenue expanded by just 30% year over year to $1.6 billion in the second quarter, the slowest pace since before the pandemic.

It appears DoorDash miscalculated just how much its revenue would slow down because the company still grew its costs in the quarter by 41% year over year, which led to a blowout net loss of $263 million. It actually trimmed back its marketing spend slightly, but that may be a reason why the company didn't grow as quickly as in the past. Users of food delivery apps aren't exactly loyal; 62% of Americans use multiple providers, so moving out of the spotlight could quickly result in a loss of business.

Still, cutting costs is one of the few ways DoorDash can reach profitability one day, because it doesn't have other business segments to fall back on, like Uber does.

If the Department of Labor enforces the proposed changes to contract workers, DoorDash could face a world of difficulty when it comes to turning its bottom-line losses around.