After a challenging year that saw the Nasdaq Composite plunge 33%, many companies started 2023 on the back foot. But they have since started arching forward a bit with the same index rising 10% year to date.

Despite the slight recovery, a looming recession has multiple analysts uncertain about how long it will last. As a result, now is an excellent time to invest in stocks that are likely to offer consistent growth over many years regardless of short-term headwinds. 

Here are two top stocks to buy in February and hold for the long haul. 

Apple 

Since the start of 2023, Apple (AAPL -2.19%) shares have risen 10% as investors have grown bullish on its prospects in the new year. Wall Street has rallied after multiple reports in recent weeks have revealed exciting developments, such as the company's move to boost iPhone profits over the long term by using more in-house components.

On Feb. 2, Apple will release its first quarter of 2023 earnings, and expectations are not especially high. Refinitiv analysts expect the company to report just over $121 billion, which would be its first revenue decline since 2019 after earning $123.9 billion in Q1 2022. The stunted forecast comes after iPhone production issues last quarter led to low supply throughout the holiday season.

With Apple likely to report an underwhelming quarter, February could present an opportunity to buy the company's stock at a bargain. However, even if that doesn't happen, Apple's stock has proven a reliable investment thanks to its 243% growth over the last five years and 779% rise over the last decade.

Apple could get some good news this month as multiple reports state the company will soon release an augmented reality/virtual reality (AR/VR) headset. According to Grand View Research, the AR market was worth $25 billion in 2021 and will expand at a compound annual growth rate (CAGR) of 40.9% through 2030. Considering Apple is likely to be the biggest name in the market, with similar headsets currently offering exclusively VR features, the company could be in for significant gains from this burgeoning market. 

Microsoft 

Microsoft (MSFT -1.96%) released its Q2 2023 earnings on Jan. 24, reporting underwhelming results. Its personal computing segment continued to drag down revenue, falling 19% year over year to $17.5 billion. Meanwhile, its cloud-computing business -- which is still growing -- slowed a bit with revenue increasing 18% to $21.5 billion compared to 20% growth in the prior quarter.

As a result, Microsoft shares are down 20% year over year. However, the drop in stock price only makes the company more compelling as an investment now thanks to its reliable growth over the long term and priority on burgeoning markets. 

Microsoft shares have risen 166% over the last five years and by 786% over the last 10 years. This stellar growth is largely owed to the tech giant's leading positions in multiple lucrative industries, such as operating systems, productivity software, cloud computing, and more.

Additionally, the company consistently invests in technology of the future, most recently proved right by its $1 billion investment in artificial intelligence (AI) company, OpenAI, in 2019.

The AI start-up wowed tech enthusiasts in November with the launch of ChatGPT, a chatbot capable of creating human-like prose based on prompts. The service will soon be available through Microsoft's Azure and is expected to incorporate its search engine Bing in the future. 

It's still early days for the AI market, but the industry was worth $93.5 billion in 2021 and is expected to grow at a CAGR of 45% through 2030, per Grand View Research. With Microsoft reportedly considering another $10 billion investment in OpenAI, the company could profit long term from the quickly expanding industry. 

Microsoft has suffered at the hands of macroeconomic headwinds over the last two years, but the challenges won't last forever. Meanwhile, the company's long-term performance makes it a must-buy this February.