Many tech stocks tumbled over the past few months as rising interest rates and other macroeconomic headwinds sparked a retreat toward more conservative investments. However, a handful of resilient blue chip tech stocks withstood that sell-off a lot better than the speculative growth plays.

Two of the most resilient names were Apple (AAPL 1.27%) and Alphabet (GOOG 0.74%) (GOOGL 0.55%). Both stocks pulled back about 20% this year but outperformed the Nasdaq's year-to-date decline of nearly 30%. They also weren't crushed like the hypergrowth tech stocks.

Should investors buy shares of Apple or Alphabet right now? Let's evaluate their core businesses, near-term challenges, and valuations to decide.

A person is showered by cash.

Image source: Getty Images.

The differences between Apple and Alphabet

Apple and Alphabet are often mentioned in the same breath, but they operate completely different business models.

Apple is one of the world's top smartphone makers, and its hardware portfolio also consists of iPads, Macs, Apple Watches, AirPods, HomePods, and other devices. Its sprawling software and services ecosystem -- which includes Apple Music, Apple TV+, Apple Arcade, and other paid services -- locked in 825 million paid subscriptions in the second quarter of 2022.

During that quarter, Apple generated 52% of its revenue from iPhones, 11% from Macs, 8% from iPads, and 9% from other hardware devices and accessories. The remaining 20% came from its services segment.

Alphabet's Google owns the world's largest online search engine, its most widely used mobile operating system (Android), its top streaming video platform (YouTube), its leading web browser (Chrome), and its most popular email service (Gmail). It also owns Google Cloud, the world's third-largest cloud infrastructure platform.

Alphabet generated 80% of its revenue from Google's advertising business in its latest quarter. Another 10% came from Google's nonadvertising businesses (including subscriptions and hardware sales), and 9% came from Google Cloud. The remaining sliver mainly came from Alphabet's "other" experimental businesses -- which include its autonomous driving and life science subsidiaries.

Both companies still face macroeconomic challenges

Apple and Alphabet are both firmly profitable and generate plenty of cash, so they're better insulated from rising interest rates than unprofitable companies with negative cash flows. However, neither company is completely immune to the other macroeconomic headwinds.

Apple still generates most of its revenue from hardware sales, and its shipments have been throttled by supply chain constraints in recent quarters. It also expects its sales in the Greater China area, which accounted for 19% of its revenue last quarter, to be disrupted by the recent COVID-19 lockdowns.

As Apple's hardware growth decelerates, it will likely ramp up its spending to develop new subscription services and hardware devices. That pressure will likely reduce its near-term margins and earnings growth.

Apple's revenue and earnings grew 33% and 71%, respectively, in fiscal 2021 (which ended last September) as it rolled out its first family of 5G devices. But in fiscal 2022, analysts expect its revenue and earnings to grow just 8% and 10%, respectively, as it laps those difficult comparisons and grapples with the ongoing supply chain and COVID-19 challenges.

Google's core advertising business usually thrives in times of economic growth but struggles during economic downturns. It suffered a slowdown in the first half of 2020 as the pandemic spread, but the growth of Google Cloud throughout the early days of the crisis cushioned that blow.

Its advertising business recovered in the second half of 2020, and Google Cloud continued to expand. That momentum continued throughout 2021, but an unexpected slowdown at YouTube (to 14% year-over-year growth) in the first quarter of 2022 spooked investors last month. Its commitment to ramping up its investments, even as its advertising business faces unpredictable headwinds this year, also alarmed investors.

Alphabet's revenue and earnings rose 41% and 91%, respectively, in 2021 as it faced easy comparisons to the first half of 2020. But this year, analysts expect Alphabet's revenue to grow just 16% as its earnings dip 1%.

The valuations and verdict

Apple trades at 24 times forward earnings, while Alphabet has a forward price-to-earnings ratio of 20. Apple pays a forward yield of 0.6%, but Alphabet doesn't pay any dividends.

I own both of these stocks, and I believe they're both reasonably valued right now. But if I had to buy more shares of one of these stocks, I'd pick Alphabet for these simple reasons: Its advertising business isn't as cyclical as Apple's hardware business, it isn't heavily exposed to supply chain challenges, it has limited exposure to China, and its stock is a bit cheaper.