While no one likes to see their stocks lose value, it can also create a buying opportunity. The S&P 500 officially entered a bear market a couple of months ago, and when that happens, you can purchase high-quality companies at a discount -- provided you choose wisely and have patience.

Since the start of the year, Costco Wholesale (COST 0.17%) and Apple (AAPL 1.27%) have seen their stock prices drop by about 3.9% and 2.5%, respectively, and that's after regaining some ground over the past month. With both down for the year, this makes it an opportune time to see if their long-term prospects remain strong.

Three people looking at a document.

Image source: Getty Images.

Costco

Costco Wholesale has had a lot of success over the years by executing a simple concept: providing a range of high-quality goods and services at low unit prices. Customers at its warehouses pay annual membership fees to shop there.

But they don't seem to mind. Paid membership continues to increase, finishing the fiscal third quarter (ended May 8) with 64.6 million members, up from 53.9 million for the quarter ended Sept. 1, 2019, before the pandemic began. With renewal rates hovering around 90% for years, it has garnered a loyal membership base, too.

Loyal and growing members have added up to consistently growing profitability. In the most recent quarter, same-store sales (excluding the impacts of foreign currency translations and gasoline prices), increased by 11%. Operating income, despite confronting higher costs that have also affected other retailers, increased by 7.7% to about $1.8 billion.

In a positive sign about its growth prospects, Costco continues to open new warehouses. This year, it has expanded by 14, ending the third quarter with 830 warehouses. Management expected to open an additional 10 in the last quarter of the year.

Apple

Apple has built a loyal following by producing and selling must-have products such as the iPhone, Mac, iPad, and AirPods. It also provides various services, including technical, advertising, and digital content via its App store.

On the surface, Apple didn't have a great quarter. In the fiscal third quarter, ended June 25, revenue grew by 1.9% to nearly $83 billion. Operating income fell by $1 billion to $23.1 billion. But I am optimistic this will prove a temporary blip.

First, iPhone sales, which comprise 49% of Apple's latest quarterly revenue, grew by 2.8% to $40.7 billion. And that should improve as the company reportedly prepares to release its new version. Given people's desire to rush out to buy the latest iPhone, this should prove a boon to sales.

Secondly, services grew by better than 12%, to $19.6 billion. Advertising, cloud, and AppleCare were the primary drivers. These should continue growing quickly. Notably, advertising represents a fast-growing area.

With innovative products and high-quality service offerings, it won't take long before Apple's top line begins experiencing high growth again.

It's encouraging that Costco and Apple continue to execute the strategies that have brought them a lot of success. In Costco's case, it's offering members a value proposition. Apple builds in-vogue products for which people clamor. There's no reason to think that each won't produce long-term sales and profit growth that will get their stock prices trending back up.