Apple (AAPL -0.86%) and Microsoft (MSFT -0.46%) were once considered aging dinosaurs of the tech sector, but both companies were reborn under visionary leaders. Steve Jobs' return to Apple in 1997 led to the launch of innovative new products -- including the iMac, iPod, iPhone, and iPad -- which turned it into a high-growth company again. Apple's future looked murky after Jobs passed away in 2011, but it continued to grow under Tim Cook, who oversaw the expansion of its business with new devices like the Apple Watch and AirPods, as well as sticky subscription-based services like Apple Music and Apple TV+.

Satya Nadella took the helm as Microsoft's third CEO in 2014 and executed a "mobile first, cloud first" strategy to reduce its dependence on desktop software. Under Nadella, Microsoft converted most of its flagship software into subscription-based cloud services and cross-platform mobile apps, grew Azure into the second-largest cloud platform in the world, and strengthened its hardware business with new Surface devices and Xbox consoles.

Apple's Fifth Avenue store in Manhattan.

Image source: Apple.

Over the past 10 years, Apple generated a total return of nearly 580% as Microsoft generated an even higher total return of more than 760%. Both of these blue-chip tech stocks are still solid long-term investments -- but is one of them a better buy in this brutal bear market?

The differences between Apple and Microsoft

Apple generates most of its revenue from hardware devices, but Microsoft generates most of its revenue from software and cloud-based services. In the first half of fiscal 2022 (which started last September), Apple generated 55% of its revenue from iPhones, 10% from Macs, 7% from iPads, and another 11% from its wearables, home, and accessories segment. The remaining 18% of its revenues came from its services segment, which houses its App Store, Apple Pay, and subscription-based services.

Microsoft splits its sprawling business into three main segments: productivity and business processes (32% of revenue in the first nine months of fiscal 2022, which started last July), which houses Office, Dynamics, and LinkedIn; intelligent cloud (37% of revenue), which handles Azure and its server products; and more personal computing (31% of revenue), which includes its Windows, Xbox, Surface, search, and advertising businesses.

Which company generates more consistent growth?

Apple's dependence on the iPhone makes it a more cyclical company than Microsoft. Apple's iPhone sales surged 39% in fiscal 2021 after it launched the iPhone 12, the company's first family of 5G devices, but it now faces much more challenging year-over-year comparisons with the iPhone 13. Chip shortages and supply chain disruptions are also exacerbating that slowdown.

However, Apple's Services segment is growing like a weed. It locked in 825 million paid subscriptions across all its services in the second quarter of 2022, representing an increase of 165 million over the past 12 months.

Wall Street expects Apple's revenue and earnings to grow 8% and 9%, respectively, this year. In 2023, they expect its revenue and earnings to rise 5% and 6%, respectively, but that doesn't fully factor in the potential launches of new augmented-reality devices or additional subscription services.

Microsoft's business is more diversified and less cyclical than Apple's but relies heavily on the continued growth of its entire cloud business -- which grew its revenue 32% year over year in the third quarter of fiscal 2022 and accounted for nearly half of Microsoft's top line.

Azure is that segment's core growth engine and should remain a compelling alternative to the market leader, Amazon Web Services (AWS), for companies (especially retailers) that don't want to feed Amazon's most profitable business.

Analysts expect Microsoft's revenue and earnings to grow 18% and 16%, respectively, in fiscal 2022. They expect that stable growth to continue in fiscal 2023 as its revenue rises 14% and earnings climb another 15%.

The valuations and verdict

Apple trades at 23 times forward earnings and pays a forward dividend yield of 0.6%. Microsoft has a forward price-to-earnings ratio of 25 and pays a slightly higher forward dividend yield of 1%.

Apple became a safe-haven stock as interest rates rose, since it's firmly profitable and sitting on $193 billion in cash and marketable securities, but it arguably became a bit overvalued relative to its near-term growth prospects. Microsoft also earned a safe-haven reputation, since it was sitting on $105 billion in cash, cash equivalents, and short-term investments in its latest quarter, but a lot of that cash has already been earmarked for its planned purchase of Activision Blizzard for $68.7 billion.

Nevertheless, Microsoft arguably faces fewer macro headwinds than Apple, it pays a higher dividend, and its stock looks more reasonably valued relative to its near-term growth. If I could only choose one of these stocks right now in this choppy market, I'd definitely stick with Microsoft.