Apple (AAPL 0.50%) is beloved by both retail and institutional investors. It's consistently one of the most popular stocks on Robinhood Markets' commission-free trading platform, and Warren Buffett's Berkshire Hathaway devotes nearly half of its entire portfolio to Apple.

It's widely held because it's both a safe-haven stock that has withstood multiple bear markets and an attractive growth play that thrives during bull markets. Over the past five years, Apple's stock surged more than 220% as the S&P 500 advanced roughly 55%. But past performance never guarantees future gains, so let's review three reasons to buy Apple -- as well as three reasons to sell it -- to see if it's still a good long-term investment.

The Apple Store in New York City.

Image source: Apple.

The three reasons to buy Apple

The bulls love Apple because its customers are loyal to its brand, its services ecosystem is expanding, and it's sitting on a mountain of cash.

According to a recent survey by ZipDo, 92% of iPhone users plan to stick with Apple for their next smartphone purchase. An AddictiveTips survey found that 94% of iPhone users would probably stick with Apple, while only 80% of Alphabet's Google Android users were loyal to their current brand.

Apple reinforces its brand loyalty in two ways. First, it prices and promotes its products as luxury items to widen its moat against its lower-priced competitors. Second, its ever-expanding ecosystem of services locks in its users and makes it difficult to switch over to an Android device. That's probably why the iPhone's global market share actually increased from 14% to 17% between the third quarter of 2021 and the second quarter of 2023, according to Counterpoint Research.

Apple's services ecosystem -- which includes its App Store, iCloud, Apple Music, Apple TV+, Apple News+, Apple Arcade, and its other subscription-based services -- also served more than a billion paid subscribers at the end of its latest quarter. That's nearly double the number of paid subscriptions it had three years ago.

Its services segment generated 21% of its revenue in the first nine months of fiscal 2023 (which ended on July 1), compared with just 18% of its revenue back in fiscal 2019. That expansion should gradually reduce its dependence on the iPhone, strengthen its walled garden, and pave the way for the launches of its future products and services.

Apple ended its latest quarter with more than $166 billion in cash and marketable securities, which gives it plenty of room to expand its ecosystem with big investments and acquisitions. More importantly, that fortress of a balance sheet should reinforce its reputation as a safe haven stock as long as interest rates stay elevated.

The three reasons to sell Apple

The bears believe Apple's overwhelming dependence on the iPhone, its troubles in China, and its premium valuation will limit its near-term gains.

Apple generated 53% of its revenue from the iPhone in the first nine months of fiscal 2023. But over the next few years, this core business could stall out as the upgrade cycles get longer and its annual improvements become less significant.

Apple also brought in 20% of its revenue from the Greater China region during that period. China was once Apple's fastest-growing market, but it faced some major challenges over the past year. China's intermittent COVID-19 lockdowns disrupted its production and sales; protests against its primary manufacturing partner, Foxconn, temporarily shut down one of its largest plants in late 2022; and China recently banned the usage of iPhones across several government agencies.

Apple is gradually shifting its production out of China and expanding into higher-growth markets such as India, but it could take years for those strategies to bear fruit. That shift could also compress its near-term operating margins.

Analysts expect Apple's earnings per share to decline 7% this year and only rise 9% in fiscal 2024 as it struggles with the sluggish recovery of the global smartphone market and other macro headwinds. However, it still trades at 27 times forward earnings -- which seems a bit pricey relative to its near-term growth -- presumably because investors still consider it to be a safe-haven play in this volatile market. They also seem to be pricing the growth of future products such as the Vision Pro into its current valuations.

Is it the right time to buy or sell Apple?

I believe Apple's valuations could limit its near-term gains, but I'm still optimistic about its ability to expand, evolve, and generate new streams of revenue over the long term. In the meantime, this tech titan is likely to keep pouring its cash into big buybacks -- even after reducing its share count by 18% over the past five years -- as it quietly develops new products and services to reduce its dependence on the iPhone and the Chinese market.

Simply put, I think it's still the right time to buy and hold Apple. It might not generate jaw-dropping gains over the next few quarters, but investors who dump it today will probably regret that decision a few years down the road.