After a sell-off in 2022 triggered by economic declines and a looming recession ahead, this year it is crucial to invest in resilient and reliable companies that are likely to grow over the long term. Buying stocks in companies participating in high-growth markets can safeguard your investment against short-term market fluctuations. 

Apple (AAPL 0.64%) and Amazon (AMZN 1.30%) have strong positions in some of the most lucrative markets, which should offer sustained growth for years to come. These companies will likely continue expanding over the long term despite temporary economic challenges. 

While Apple and Amazon both have promising long-term outlooks, one is unquestionably the better buy in 2023. Let's assess. 

1. Apple 

Apple shares have fallen 22% since last January after a year that brought the Nasdaq-100 Technology Sector index down 29% in the same period.

Despite market declines, revenue in Apple's fiscal 2022 rose 8% year over year to $394.3 billion, with operating income increasing 9.6% to $119.4 billion. The growth was mainly thanks to the company's leading positions in consumer electronics and online services. 

For instance, while competitors like Microsoft reported a slight decline in PC revenue in the third quarter of 2022, Apple's Mac segment grew 25% year over year to $11.5 billion.

The company has come under scrutiny in recent months for its reliance on China for iPhone manufacturing. Toward the end of last year, after increased COVID-19 restrictions put strains on factories, Apple stock fell 14%. But the shares have begun recovering alongside improved production.

Meanwhile, its booming services business shows the company is smartly diversifying its revenue for the long term. In fiscal 2022, Apple's services revenue rose 14% year over year to $78.1 billion, double the 7% growth rate for iPhone revenue. Meanwhile, services reported a 71.7% profit margin, while the same metric for products came to 36.3%.

Apple's stock may have lost some steam in the last 12 months. However, its ability to continue dominating consumer product sales in an economically challenging year, along with a swiftly growing services business, proves the company is resilient and worth investing in for the long term. 

2. Amazon 

After a year to forget that has brought Amazon shares down 38% year over year, the company entered 2023 with a bang. Its stock has risen 17% since Jan. 1 and is still climbing. The rally seems to stem from the consumer price index 0.1% decline, suggesting inflation is easing, as well as an expansion of Amazon's Buy with Prime program.

Buy with Prime will allow all eligible U.S. retailers to offer Prime benefits, such as free shipping and returns on their own sites, outside of Amazon. Optimistic analysts believe the program will make the company more competitive against Shopify and allow Amazon to boost revenue by widening its net to capture sales from nearly any e-commerce site.

The potential of Buy with Prime will be music to investors' ears after the steep declines that Amazon's e-commerce business experienced last year. In Q3 2022, its e-commerce segment reported $2.87 billion in operating losses while its cloud computing business made up 100% of its operating income.

While Amazon Web Services is consistently reporting significant quarterly growth, e-commerce sales still made up 84% of the company's total revenue in Q3 2022. As a result, Amazon desperately needs to bring its online retail business back to profitability, and Buy with Prime is a promising step in that direction.

Amazon and Apple are titans of their respective markets, holding leading market shares in some of the most lucrative industries. However, when comparing their performance under last year's economic strains, Apple was the unequivocal winner, suggesting it is the more reliable investment. 

Also, Amazon's stock is trading at 90 times its earnings, while Apple's price-to-earnings ratio is far more preferable at 22. Apple's stock offers more value and is the better buy in 2023.