Things change rapidly in the software industry. Competing in this space means you have to constantly innovate to stay ahead of peers. Your profit margins are usually vulnerable to rivals both large and small, who are eager to win market share or take advantage of any misstep you might make.

And yet some software specialists, like Microsoft (MSFT 1.28%) and Shopify (SHOP 3.45%), have built enduring businesses that can deliver predictable earnings growth through a wide range of selling environments. They've done so with the help of competitive assets like large sales footprints, diverse revenue streams, brand power, and customer loyalty. Their stocks are attractive long-term investments, too, despite having beaten the market so far in 2023.

1. Microsoft

Microsoft recently announced that it is raising its dividend by 10% for the second straight year. While its yield remains small compared to other members of the Dow Jones Industrial Average, these double-digit hikes illustrate how Microsoft stands out by having unusually strong finances.

The software giant boosted operating income by 14% in the past year after accounting for currency exchange rate swings. The resulting $90 billion of profit translates into an eye-popping 42% of sales. Microsoft is sitting on over $111 billion of cash today and generated nearly $100 billion of operating cash flow in the past year. These market-leading metrics reflect the company's prime market position in major verticals like cloud services, digital entertainment, and cybersecurity.

Sure, parts of Microsoft's product portfolio are struggling today. Consumers aren't interested in buying PCs and other consumer tech devices right now, for example, and video game demand is also soft. But the global business is diverse enough to expand sales and profits even when some tech niches are in a cyclical downturn. Investors have good reasons to be excited, meanwhile, with Microsoft's exposure to an impending boom in artificial intelligence (AI) that could dramatically boost the value of its software services.

2. Shopify

Shopify shareholders also have some legitimate reasons to be optimistic about AI improvements, but those gains are a smaller part of the bullish thesis for the thriving e-commerce platform provider. The industry has returned to growth following a rare decline in late 2022, helping boost the volume of transactions that Shopify handled by 17% in the most recent quarter. The services division is expanding at an even faster clip, with subscription revenue rising 21% thanks to the combination of a growing pool of merchants and higher annual fees.

This software-as-a-service business is also transitioning into a more profitable enterprise following some significant losses over the past few years. The sale of its logistics segment helped free cash flow climb to $97 million this past quarter, or 6% of sales, compared to an outflow of $87 million a year earlier. Management is projecting big improvements in this metric for the rest of 2023 and beyond.

Shopify's stock, like Microsoft's, is valued at a premium. Investors are paying roughly 12 times annual sales for both software companies today. Shopify is riskier due to its less established business and smaller sales footprint. In exchange, though, shareholders get exposure to a business that could grow sales at a faster clip for many years.

The company accounts for about 10% of digital transactions in the U.S. market today, and that share could expand meaningfully even as e-commerce sales steadily rise beyond their current level of 15% of the total retailing pie. A decade ago, that figure stood below 7%. Investors who hold Shopify stock for the long haul can expect to benefit from further boosts over the next five, 10, and 15 years.