It's always a good idea for investors to have a long list of stocks they've fully researched ready to go in case the stock market tumbles. Opportunities to buy great companies at great prices don't come often and don't last long.

Two stocks I'll be keeping tabs on throughout 2024 are Twilio (TWLO 1.47%) and Cloudflare (NET 1.44%). Both are too expensive for me at the moment, but at the right price, I could see either one in my portfolio.

1. Twilio

Shares of communications platform Twilio are down more than 80% from their pandemic-era high. This isn't a case of the market overreacting. Twilio's growth has slowed to a crawl, prompting the company last year to reorganize its business into two distinct parts. The communications segment, which houses the company's mature products, would focus on efficiency and profit. The data and applications segment, comprised of high-value software products, would aim to accelerate growth.

Twilio's plan is only partially working. While the company has outpaced its targets for the communications segment, the other side of the business is struggling. Data and applications revenue grew by just 9% in the third quarter, barely faster than the mature communications segment.

The performance of Segment, which Twilio acquired in late 2020, has been a problem. Segment is a customer data platform that enables customers to aggregate customer data from various sources and create personalized customer experiences. It's not a simple product, and Twilio's sales efforts have stumbled. While its core messaging product is easy to explain -- use an API to send text messages -- Segment is a trickier sell.

The sales and marketing resources Twilio has dedicated to Segment haven't produced the kind of growth the company was expecting, so it's pulling back and laying off a portion of its workforce. This is a big hit to the company's turnaround story.

While Twilio is struggling, I'm a fan of the company's push to become profitable. Twilio is targeting GAAP profitability, not just profitability on an adjusted basis that backs out a bunch of real costs like stock-based compensation. The plan is to turn a generally accepted accounting principles (GAAP) profit by 2027, although the company's growth challenges may push back that date.

Twilio stock isn't cheap, trading for more than 3 times revenue estimates despite its challenges rekindling growth. I wouldn't buy the stock at the current price, but I'll be keeping an eye on it in 2024. At the right price, Twilio is a turnaround story worth betting on.

2. Cloudflare

The reason for my interest in Cloudflare is its incredible optionality. The company operates a global edge network that speeds up and protects websites, and it's continually layering new products and services on top. One example is the company's serverless computing platform. Cloudflare Workers enables developers to run code close to users, and a variety of data products make it easy to build full-scale applications on Cloudflare's network.

While Cloudflare has taken its time jumping into the artificial intelligence market, the company is now full steam ahead. GPUs are being installed in its data centers around the world, and the Workers AI product enables developers to run AI models directly on Cloudflare's network. The company is focusing on AI inference, not AI training, betting that inference will ultimately be a bigger market in the long run.

Cloudflare is on its way to becoming a cloud computing giant and perhaps an AI giant, and that's certainly reflected in the stock price. Cloudflare is valued at about $29 billion, or roughly 22 times the average analyst estimate for full-year revenue. Even with Cloudflare's immense potential, that's a valuation I just can't get behind, especially considering the company has yet to turn a GAAP profit.

For now, Cloudflare remains on my watchlist for 2024. If the stock takes a dive sometime next year, I'll reassess. Cloudflare is a stock I'd like to own, but the price is just too optimistic for my tastes.