There's a lot of uncertainty among stock analysts these days, with many at odds about whether there's currently a bear or bull market. Some experts are celebrating that multiple stocks have recovered after suffering from an economic downturn in 2022. However, others are not sure if it will last, with a potential slowdown in earnings bringing the market back down in the coming months. 

As a result, now is an excellent time to invest in companies with a history of solid growth, which can make temporary headwinds inconsequential over the long term. Companies like Amazon (AMZN) and Apple (AAPL) are attractive options, as they have granted investors consistent gains over the last decade, thanks to the potency of their respective businesses.

Additionally, it doesn't take tens of thousands of dollars to benefit from these companies' potential growth. So, got $1,000? Here are two stocks to buy for the long term. 

1. Amazon

Amazon lost steam in 2022, with its stock tumbling 50% throughout the year as macroeconomic challenges hit its business particularly hard. However, the company continues to have solid long-term prospects thanks to its positions across multiple sectors.

Despite a downturn in e-commerce last year, Amazon's leading 38% U.S. market share in the industry could prove a massive asset in the coming years. Its dominance is most evident by Walmart's second-largest share of 6%, making Amazon well-positioned to profit substantially from the sector's growth. And according to Statista, the e-commerce market is projected to grow by more than 53% by 2027 and hit nearly $6 trillion.

Moreover, Amazon has steadily expanding positions in cloud services with Amazon Web Services (AWS) and artificial intelligence (AI). These industries have become closely intertwined in recent months as more cloud platforms are expanding their range of AI services. Meanwhile, Amazon holds the largest cloud market share, at 32%.

Amazon shares have soared around 800% over the last decade, proving the company's strength as an excellent long-term investment. Amazon may have stumbled last year, but its diverse business serving several high-growth markets gives it a solid outlook over the next 10 years and beyond.

2. Apple

While Amazon dominates e-commerce, Apple is leading the way in consumer technology. The company's devices have gained such traction with shoppers that Apple is responsible for the third-largest share in e-commerce in the U.S. at 4%, despite selling a considerably more limited range of products than others in the industry.

Consistent demand for Apple's products has seen its stock skyrocket more than 1,000% since 2013, as it has attained leading market share in smartphones, tablets, smartwatches, and headphones. As a result, in the same period, Apple's revenue climbed 131%, and operating income increased by 144%.

The iPhone company's success with consumers is primarily thanks to its priority on quality products and an interconnected ecosystem that sets it apart from the competition. Advanced connectivity between its devices promotes ease of use, but also makes consumers think twice before switching to non-Apple alternatives. This strategy makes the company exceptionally skilled at entering new product categories, which makes the recent debut of its virtual/augmented reality (VR/AR) headset promising for its future.

Called the Vision Pro, the new headset was announced on June 5 and will start at $3,500 once it launches in early 2024. The high price point makes the device out of reach for many consumers. However, future generations of the headset will likely bring the cost down. Meanwhile, Apple can use this time to hone its VR/AR technology and attract app developers to expand the headset's capabilities.

It will take time, but Apple's dominance in consumer tech and brand loyalty give it a better chance than most to flourish in the high-growth sector over the long term. That means now is an excellent time to stock up on Apple shares.