Apple's (AAPL 0.64%) brand power and robust sales of iPhones and Macs have provided a cushion under the stock in a volatile year for the markets. Year to date, shares of Apple have fallen 19%, which is slightly better than the S&P 500 index decline of 22.5% at the time of writing. As investors well know, many growth-oriented tech stocks have fallen much harder.

With high inflation causing increasing uncertainty about the direction of the economy and the stock market, investors are probably wondering whether they should buy or sell Apple right now. 

While there are good reasons to believe Apple can continue to outperform the market in this environment, the company doesn't necessarily make affordable products, which could be a problem if the economy slows further in 2023.

Let's first review two reasons to be bullish on Apple before considering why you still might want to avoid the stock.

Gaining market share

The markets Apple competes in are highly competitive. There are many vendors for smartphones, PCs, and tablets, and these devices were in high demand during the pandemic with more people working from home. This makes Apple's recent share gain in smartphones all the more impressive.

Samsung is the top smartphone manufacturer, with 21.8% market share in the second quarter. Apple is second with 15.6%, but both companies have gained share over the last year at the expense of the rest of the market. Apple's share was up from 14.2% in the same quarter of 2021.

Apple is also gaining share with the Mac. In the third quarter, Mac overtook Dell for the top spot in the U.S. market for personal computers with a 28.8% share. This important gain comes as Apple is enjoying strong demand for its new Mac lineup powered by its proprietary M1 processors, recently moving into the M2 generation.

Clearly, these market share gains reflect a strong brand but also a superior supply chain during a time of shortages across the semiconductor industry. CEO Tim Cook's experience as Apple's Chief Operating Officer under Steve Jobs shouldn't be overlooked.

Demand for iPhone 14 Pro Max

Apple set a record for iPhone revenue in the fiscal third quarter ending in June, and analysts expect another relatively strong quarter of sales in the next quarter. The consensus analyst estimate is calling for total revenue to grow 6.6% year over year, but one analyst believes Apple will report even better numbers.  

The new iPhone 14 Pro Max, which sells at the premium price of $1,099,  has experienced stronger demand than Apple expected. The company has reportedly cut production of the cheaper iPhone 14 Plus, as more customers opt for the top-shelf model. Morgan Stanley analyst Erik Woodring believes Apple will report a better-than-expected quarter due to sales of iPhone, iPad, and Mac remaining stable amid a challenging economic environment. Woodring sees Apple reporting revenue about 3% above the $88.9 billion consensus revenue estimate for the September-ending quarter.

iPhone risks and premium valuation

One uncertainty for Apple looking ahead to 2023 is a lengthening replacement cycle for iPhone. Some users upgrade about every three to four years, according to some estimates. Since the iPhone still makes up about half of total revenue, this could present a problem for Apple's growth if consumers start to hold back on upgrading to new iPhones in a recession. 

This presents a near-term downside risk to the stock price that investors have to decide if they are willing to accept in order to achieve long-term gain. The stock trades at a forward price-to-earnings (P/E) ratio of 22, which is a premium to the S&P 500's forward P/E of 17. One weak quarter would likely send the stock down from these valuation levels.

Apple generated over $100 billion in free cash flow over the last year and has nearly as much in net cash sitting in the bank. It's a financial fortress that can navigate difficult waters in the economy. But if you are looking for undervalued stocks with low downside risk in the near term, Apple doesn't fit those criteria.

With the stock trading at a premium valuation, I would be cautious about buying Apple shares in an era of inflation at 40-year records.