As the world's first and second most valuable companies by market capitalization, Apple (AAPL 5.98%) and Microsoft (MSFT 2.22%) are favorites on Wall Street. The tech giants have a long history of delivering consistent growth, with both companies' annual revenue rising by over 48% since 2018. Meanwhile, their stocks have climbed more than 200% in that period. 

In 2023, Apple and Microsoft have made investors bullish with expansions into high-growth markets such as artificial intelligence (AI) and virtual/augmented reality (VR/AR). Despite potential macroeconomic headwinds, these companies have solid long-term outlooks thanks to their dominance in tech. As a result, it's not a bad idea to grow your portfolio by adding shares in Apple or Microsoft. 

However, before you go all in on one of these companies, make the most of your investment by finding out which is the better buy. So, let's look at whether you're better off with Apple or Microsoft's stock. 

Apple: Concerns over future sales in China

Shares in Apple tumbled about 6% in the first week of September after reports that China had banned government workers from using iPhones amid growing tensions with the U.S. The country is Apple's third-largest market, accounting for 18% of its total revenue in fiscal 2022. Consequently, a potential expansion of these regulations to the public caused panic among stockholders.

However, the dip may be overdone, creating an investment opportunity. On Friday, Morgan Stanley analyst Erik Woodring said that he believes China is unlikely to roll out these restrictions nationwide. And if it did, Apple's revenue would dip by 4%, with earnings per share down 3%. Meanwhile, JPMorgan similarly said that based on the material impact of past restrictions by China, it does expect this change to affect "consumer purchasing behavior."

Moreover, Apple is quickly expanding its digital services business, which allows it to lean less on product sales. Its services segment is the second-highest earning part of its business, with revenue rising 8% year over year in the second quarter of 2023. Its growth is outpacing iPhone revenue, strengthening Apple's earnings potential over the long term. Additionally, expanding ventures into AI, fintech, and VR/AR could further bolster Apple's business in the coming years. 

Microsoft: A lucrative lead in AI

Microsoft's stock has climbed 40% year to date, steadily becoming one of the biggest names in AI. The company invested $1 billion in ChatGPT developer OpenAI in 2019, which granted Microsoft exclusive licenses on several of the start-up's AI models. As a result, the Windows company has brought AI upgrades to several of its services, including Word, Excel, Bing, and Azure.

Microsoft's swift rise in the industry has led it to announce that its AI venture could hit $10 billion in revenue faster than any of its other businesses did. The tech giant is home to a large library of potent brands, which thousands of businesses worldwide have come to rely on regularly. Meanwhile, AI-enabled releases in its Microsoft 365 Office suite will likely help countless companies adopt the technology in their daily workflows.

Microsoft has a lucrative opportunity in AI, combining its popular productivity platforms with OpenAI's technology. The company's revenue rose 7% year over year to $212 billion in its fiscal 2023 (ended in June). The growth was driven by a 9% increase in productivity and business-processes revenue, and a 17% boost in its intelligent cloud segment. Both divisions are heavily expanding in AI, giving Microsoft solid prospects in the industry. 

Is Apple or Microsoft the better buy?

Apple and Microsoft are solid growth stocks, allowing investors to profit from the ever-evolving nature of the tech industry. However, Microsoft appears to be the more reliable option for now. As a software-first company, Microsoft is thriving amid a current AI boom as its cloud business and productivity platforms attract millions of users. 

Meanwhile, Apple has experienced three consecutive quarters of revenue declines, burdened by reduced spending in its product segments during poor economic conditions. A large portion of Apple's research and development spending is owed to AI. However, the company has yet to carve out a solid position in the industry. 

Furthermore, the iPhone company's issues in China are unlikely to affect its business significantly. However, with a potential recession still on investors' minds, investing in a software titan like Microsoft might be a safer bet. As a result, if you're having trouble deciding between these tech giants, Microsoft is the better stock this month and an excellent long-term investment.