Tech stocks have been surging in 2023. The Nasdaq Composite, which is skewed toward technology stocks, has jumped more than 30% so far this year. Investors are clearly getting more comfortable betting on riskier stocks after sentiment shifted hard in the other direction in 2022.

Twilio (TWLO 1.47%) and Cloudflare (NET 1.44%) are both up substantially this year, but the growth stocks remain far below their pandemic-era peaks. Here's why both are positioned for comebacks over the long run.

Twilio

Shares of cloud messaging platform provider Twilio are down a whopping 85% from their pandemic-era high. Revenue growth has slowed dramatically as Twilio's customers pull back on spending in a tough economy. While Twilio booked 61% revenue growth in 2021, the top line expanded by just 35% in 2022.

Growth has slowed further this year, with just 15% year-over-year revenue growth in the first quarter. Twilio's guidance calls for revenue growth of less than 5% in the second quarter.

A toxic combination of vanishing growth and persistently enormous losses have turned investors against Twilio stock. While Twilio is profitable on a non-GAAP basis, that dolled-up number backs out stock-based compensation. The company posted a GAAP net loss of $342 million in the first quarter on $1 billion in revenue, along with a free-cash-flow loss that topped $100 million.

Twilio's growth isn't going to rebound overnight, but the company's turnaround plan should give investors some confidence that it recognizes the need to push toward sustainability. Twilio is looking to get its organic growth rate back in the 15% to 25% range in the next few years and is targeting GAAP profitability by 2027.

The company plans to knock down stock-based compensation to a range of 10% to 12% of revenue by that year, along with implementing other cost-cutting measures. Twilio laid off 17% of its workforce earlier this year and rearranged its operating structure to better reflect the growth potential of its core products.

In the communications segment, which covers Twilio's core messaging products, the focus is now on boosting efficiency. In the software segment, which covers higher-value services, the imperative is accelerating growth.

For years, Twilio's rapid-fire growth led investors to ignore profit and sustainability entirely. No more. Twilio's turnaround will be a multiyear affair, but the company has set the right goals.

It's not shooting to make some heavily doctored profitability metric positive, like some companies. Instead, it's pushing to become unequivocally profitable and lay the foundation for its next phase of growth.

If Twilio can deliver on its plan, the stock could be in for a big rebound in the coming years.

Cloudflare

Edge computing leader Cloudflare is seeing a slowdown, as well, although the company's growth rate is still squarely in double-digit territory. The company reported year-over-year revenue growth of 37% in the first quarter and guided for growth of 30% in the second quarter. On an absolute basis, those numbers look good.

But relative to Cloudflare's pandemic-era valuation, this growth is just not good enough. The company was valued near $70 billion in late 2021, putting the price-to-sales ratio based on 2021 revenue over 100.

As growth has slowed and the sentiment toward soaring growth stocks has cooled, Cloudflare's stock has fallen off a cliff. The company is now worth roughly $22 billion, and the stock has tumbled nearly 70% from its all-time high.

Even today, Cloudflare trades at a premium valuation. The company expects full-year revenue of around $1.282 billion, putting the forward price-to-sales ratio at about 17. That's still elevated, and it's possible the stock is in for another correction.

But in the long run, Cloudflare's vast and growing market opportunity can push the stock back toward those all-time highs. By 2026, Cloudflare expects its total addressable market to reach $204 billion, up from just $32 billion in 2018. The company's relentless innovation and knack for layering products and services on top of its global edge computing network have opened multiple new growth opportunities.

Beyond the core content delivery and security businesses, Cloudflare's developer platform is becoming a formidable alternative to traditional cloud computing platforms like Amazon Web Services. That's a massive opportunity in its own right. Cloudflare is also emerging as a major player in the Zero Trust market, and the company will likely enter new markets over the next few years as it exercises the optionality of its platform.

It may take a while for Cloudflare stock to catch up with its valuation, especially given the current economic climate. But over the next decade, the stock could be a big winner if Cloudflare can take advantage of its myriad growth opportunities.