It's easy to find companies that are experiencing short-term gains as a result of hype rather than real growth. Finding companies that are growing fast and have the potential to go the distance in your portfolio can be much more challenging.

But hypergrowth stocks that are also great long-term investments are out there. And two companies that fit this description are Nvidia (NVDA 6.18%) and Microsoft (MSFT 1.82%)

A person sitting at a computer.

Image source: Getty Images.

1. Nvidia's long-term AI potential 

For years, Nvidia's graphics processing units (GPUs) were best known for their capabilities for gaming. The company's processors then caught investors' attention for their use in cloud computing, and now it's becoming clear that Nvidia's GPUs will help power the technological shift toward artificial intelligence (AI). The company's GPUs are fast and very good at AI processing, making them a top choice for many data centers.

OpenAI's release of ChatGPT last year started an AI race, with nearly every major tech company now focusing on gaining ground in this newly established market. The great news for Nvidia is that its GPU tech will benefit from the demand for high-powered servers regardless of which tech giant comes out on top. 

And AI is already paying off in significant ways for the chipmaker. Nvidia's revenue spiked 101% year over year, and adjusted earnings per share (EPS) soared 429% in the second quarter, thanks partly to "tremendous" AI demand for its chips. 

Of course, Nvidia won't always put up that level of growth. But it's worth remembering that we're still in the early earnings of this shift to AI. As more companies and industries realize what artificial intelligence can do for them, demand for chips that power AI infrastructure will likely increase. Some estimates put the current AI chip market size at $28 billion right now -- and it could reach an estimated $165 billion by 2030. 

2. Microsoft's early bet on AI 

I'm sticking with the AI theme here because this market has a lot of potential long-term upside for investors. And while Microsoft may not be as flashy as small AI start-ups, it's good to remember not to choose stocks based on style alone. 

Microsoft has substance in spades. The company was an early investor in OpenAI and has poured an estimated $13 billion into the ChatGPT creator thus far. That's a lot of money, and for its investment, the company reportedly has a 49% stake in OpenAI and will collect some of the profits OpenAI makes until it recoups its investment.

Microsoft's wise bet on OpenAI also gives it access to the company's latest artificial intelligence technologies, making Microsoft's own products and services smarter and more desirable in the process. 

And just like Nvidia, Microsoft will also benefit from surging artificial intelligence infrastructure demand in the coming years. Microsoft's Azure is the second-largest cloud computing infrastructure company after Amazon. And that means that as companies look for cloud computing services that can handle complex AI processing, Azure will likely top their list of choices. 

Estimates from Grand View Research put the potential size of the AI cloud market at $647 billion by 2030. With Microsoft already in a powerful cloud position and heavily invested in one of the leading AI companies, the tech giant is well-positioned to continue leading in the AI market for years. 

Remember that growth comes in spurts

AI could cause Nvidia and Microsoft to grow significantly in the coming years. But while this may happen, it's also worth remembering that a company's growth isn't usually perfectly consistent from quarter to quarter. So, if you buy (or already own) shares of these companies, just keep in mind that even as they benefit from AI's trajectory, there will likely be some periods where they slow down a bit. 

When that happens, just evaluate whether anything has fundamentally changed with the company's investment story. If it hasn't, then stay the course.