Artificial intelligence (AI) spending across hardware, software, and services totaled about $200 billion last year, according to Grand View Research. But that figure is expected to soar 820% to exceed $1.8 trillion by 2030. In other words, the AI market is forecast to compound at 37% annually through the end of the decade.

Many companies will benefit from that rising tide, but Cloudflare (NET 1.44%) and ServiceNow (NOW 1.02%) stand out because they have strong footholds in relevant markets. Additionally, both stocks trade at reasonable valuations compared to Wall Street's growth expectations.

Here's what investors should know.

1. Cloudflare

Cloudflare operates a connectivity and security cloud. Its platform accelerates and protects software and infrastructure across private data centers and public cloud environments. The company also offers a developer platform that lets businesses tap its network to build and deploy websites and applications, and it's particularly focused on supporting inference for artificial intelligence applications.

Cloudflare has material advantages in speed and scale. Specifically, the company operates the fastest cloud network and developer platform on the market. It also handles about 20% of web traffic, which provides deep insight into performance problems and security threats across the internet. Cloudflare uses that data to continuously route traffic and stop threats more effectively.

Those qualities have helped the company achieve a strong position in several cloud services markets. For instance, International Data Corp. recently recognized its leadership in zero-trust network access, citing threat detection powered by machine learning models trained with prodigious amounts of internet traffic as a key strength. Additionally, Forrester Research recently recognized Cloudflare as a leader in edge development platforms, citing a better product and stronger growth strategy compared to peers.

Cloudflare reported excellent financial results in the fourth quarter. Customers increased 17% to 189,791, and the average customer spent 15% more. In turn, revenue rose 32% to $362 million, and non-GAAP (adjusted) net income soared 148% to $53 million. Additionally, management said close rates and average deal size improved markedly compared to the previous quarter, signaling an uptick in sales force productivity.

Going forward, Cloudflare is well positioned to benefit from AI, given its leadership among edge development platforms. Additionally, its network serves as a unified control plane across private data centers and public clouds, but vendors like Amazon and Microsoft do not offer the same support. Finally, Cloudflare has been outfitting its network with Nvidia GPUs optimized for AI inference.

Last year, CEO Matthew Prince said, "By our estimates, Cloudflare is the most commonly used cloud provider across leading AI start-ups." He also mentioned that the company was "uniquely positioned to become a leader in AI inferencing."

With that in mind, Wall Street expects Cloudflare to grow revenue at 25% annually over the next five years, but that estimate leaves room for upside if the company becomes a major player in AI inference. In that context, its current valuation of 24.7 times sales is tolerable. The stock may be volatile in the near term, but patient investors with a five-year time horizon should consider buying a small position today.

2. ServiceNow

ServiceNow helps businesses unify and digitize workflows across disparate systems. Specifically, its platform integrates with third-party applications from vendors like Microsoft and Atlassian to address four primary use cases: technology workflows like IT service, customer workflows like customer service, employee workflows like human resources, and creator workflows like application development and task automation.

ServiceNow is best known for its dominance in IT service and IT operations management. But industry analysts have also recognized its leadership in other software verticals, including artificial intelligence (AI) for IT operations, digital process automation, and low-code application development platforms.

The company reported solid fourth-quarter financial results. Revenue increased 26% to $2.4 billion, and non-GAAP net income jumped 36% to $3.11 per diluted share. In addition, the remaining performance obligation (contracted revenue that has not been recognized) climbed 29%, hinting at a possible acceleration in sales growth in the coming quarters. That momentum is due in part to the demand for generative AI.

ServiceNow was quick to capitalize on generative AI following the launch of ChatGPT. In fact, it was one of the first major software platforms to bring generative AI capabilities to its customers when it launched Now Assist last September. Now Assist brings the ability to create content, summarize information, and automate interactions to IT service, field service, customer service, and human resources teams.

However, innovation at ServiceNow extends beyond AI. The company launched finance and supply chain workflows last year that simplify and automate the sourcing and purchasing of goods and services. Those tools are particularly timely because modernizing enterprise resource planning (ERP) systems has become an IT focus area.

In short, ServiceNow has a strong presence in several IT software verticals. The company is growing quickly, and it's still bringing new products to market at a steady pace. Yet, ServiceNow has tapped a small portion of its $220 billion addressable market. That lays the foundation for strong sales growth for the foreseeable future.

Indeed, Wall Street expects the company to grow sales at 20% annually over the next five years. That consensus estimate makes its current valuation of 16.9 times sales seem reasonable. Investors with a five-year time horizon should feel comfortable buying a small position in this growth stock today.