Apple (AAPL 1.30%) has been the first U.S. company to cross several key valuation thresholds: $1 trillion, $2 trillion, and now $3 trillion. However, Microsoft (MSFT -0.25%) has been trailing Apple every step of the way and often crosses these thresholds (except for $3 trillion) not long after Apple does.

The road to either company achieving a $5 trillion valuation is likely a way off, but which company has the easier path to accomplishing this goal? Let's look at both businesses and see which is a better bet to reach $5 trillion.

Apple is struggling because of weak consumer demand

Apple is an easier business to understand than Microsoft. Apple is a consumer-facing company that provides leading technology like iPhones, laptops, and now a virtual reality (VR) headset. Microsoft is a bit more complicated, as it has its hands in multiple markets.

Microsoft is best known for its products that are on practically every computer, but also owns LinkedIn, a cloud computing business (Azure), creates hardware like laptops and the Xbox family of gaming systems, and will also expand its video game wing if its deal to buy Activision Blizzard goes through.

Apple's product net isn't nearly as wide as Microsoft's, which doesn't bode as well when assessing potential growth. We're already seeing the effects of that now, as the average consumer isn't spending nearly as much on discretionary items that Apple creates, translating directly to its 1.4% revenue decline in the third quarter (ending July 1), its third straight quarterly revenue decline.

Microsoft is feeling the same pain in its More Personal Computing segment (which encompasses its hardware divisions) as revenue fell 4% year over year there, too. However, a key difference is Microsoft's balanced approach, as its intelligent cloud division was up 15%.

But during good times, Apple's consumer products can shine, so investors should be careful about extrapolating short-term results over a much longer period. With Microsoft's diverse product base, it can excel in good times while also delivering solid results when consumer demand is weak.

Still, there are some questions about how big each company can get.

Microsoft's growth plan is stronger than Apple's

In the U.S., Apple is king. It holds a 58% market share in the U.S. smartphone market but holds an even more important audience captive: ages 18 to 24. Bloomberg Intelligence found that 79% of those surveyed in that demographic preferred the iOS operating system, indicating Apple has won over a younger audience. Internationally, Apple only holds a 17% market share.

So, while domestic growth is still possible, Apple's primary focus must be international expansion if it hopes to beat Microsoft to a $5 trillion valuation.

Microsoft is already a strong international company, but its biggest growth engine will undoubtedly be cloud computing. The cloud computing market opportunity currently sits at around $678 billion, but it's expected to balloon to an astounding $2.4 trillion by 2030. With Microsoft's estimated 22% market share right now, cloud computing alone could generate $480 billion in revenue for Microsoft by 2030 if it holds a 20% stake in this vital industry. For comparison, Microsoft's trailing-12-month revenue total is $212 billion. Throw in Microsoft's other business segments growing at a market average pace, and it's not hard to see Microsoft's revenue doubling to tripling by 2030.

If you apply that logic to Apple, can it double or triple its sales of iPhones, AirPods, or Apple TV subscriptions? I'd say it's possible, but it's far from the certainty of Microsoft's future.

But does Apple have too big of a head start?

Who will reach $5 trillion first?

Both companies have seen a large pullback with the broader market over the past month, but Microsoft is only $400 billion behind Apple.

MSFT Market Cap Chart

MSFT Market Cap data by YCharts

Over the long term, that disadvantage means Microsoft will need to grow 108% to reach $5 trillion, while Apple only has to grow 79%. Both growth rates are attainable by 2030, so I think we'll see a $5 trillion company by then.

As for which will be first, I think it will be Microsoft, hands down. Cloud computing is a massive market and will receive a boost from technologies like artificial intelligence (AI), which require massive amounts of data. Smartphones and other consumer tech are fairly prevalent, so while Apple may be successful, Microsoft looks like the better long-term pick.