When a company's shares go on a run, it's reasonable to wonder whether they are still worth investing in. That's a question we can ask about Microsoft (MSFT 0.56%) and Shopify (SHOP 3.98%), two tech leaders that have been on a tear this year. The former is up 20% since January, while the latter has climbed 27%. Is there any upside left?

In my view, the answer is a resounding yes. Not only can both companies still deliver superior returns, but they also have many of the qualities required of "forever stocks." Let's dig in.

Person working at a desk.

Image source: Getty Images.

1. Microsoft

Microsoft is firing on all cylinders. The company's revenue in the fourth quarter of its fiscal year 2025, which ended on June 30, increased 18% year over year to $76.4 billion. On the profitability front, earnings per share rose 24% year over year, to $3.65. To no one's surprise, the company's cloud division had a lot to do with this strong performance. Azure and other cloud services revenue grew significantly faster -- 39% versus 30% the same period last year.

Microsoft is increasingly gaining on its competitor in the cloud industry, namely Amazon (NASDAQ: AMZN), which currently holds the spot. Furthermore, the numbers indicate that there is still significant room for growth for the company. Microsoft had $368 billion in contracted revenue on its books as of the end of the period, representing a 37% increase year over year.

Had Microsoft not seized the cloud opportunity when it did, choosing instead to focus on its operating system (OS) offerings, it would be a different company today. Although there is nothing wrong with its legacy OS business, it has been supplanted as Microsoft's most important growth driver by cloud computing and artificial intelligence, two industries that are expected to maintain an upward momentum for a very long time.

That tells us several things about Microsoft: It is a well-run, innovative company with attractive growth prospects. Add the company's moat, derived from its brand name and switching costs, and Microsoft looks likely to continue offering competitive returns over the next five years and beyond. Lastly, Microsoft is a terrific dividend stock: Don't let its meager 0.7% forward yield fool you.

Microsoft generates significant amounts of cash flow, has ample funds to more than cover its annual dividend payments -- as evidenced by its conservative cash payout ratio of 33.6% -- and has increased its payouts by 130.6% over the past decade. Microsoft is a no-brainer for growth and dividend stocks that investors can park in their portfolios for the long term.

2. Shopify

Shopify experienced a slump after reaching its all-time high in late 2021, which lasted approximately a year. Since 2023, the company has been on fire. Several changes to its business have allowed it to get back on track. Shopify increased its prices after more than a decade of not doing so. The company also got rid of its expensive logistics business. The result: Rebounding revenue growth, expanding margin, and the occasional net profit.

Shopify had most of those during the second quarter. Revenue increased 31% year over year to $2.7 billion, while its net income came in at $906 million, which was much better than the $171 million reported in the year-ago period. Shopify's free cash flow jumped by 26.7% to $422 million, while free cash flow margin remained flat at 16%.

Shopify should experience growing demand for its services over the long term as the e-commerce market continues to expand. The company has already established itself as a leader in its niche, helping merchants build online storefronts. Shopify's platform makes it easy for merchants to get started and offers a rich suite of services ideally adapted to the demands of modern commerce, so they can focus on running their businesses.

That's why Shopify's customer count has been growing at a good clip for a while, and it has grabbed more than 12% share of the U.S. e-commerce market by gross merchandise volume. Further, it also benefits from a moat thanks to switching costs and network effects. Shopify wants to be a 100-year company. This long journey has, so far, started well, and there should be plenty of upside for investors who stay the course. Shopify looks like an excellent forever stock.