During times of market pessimism, investors are often overcome with fear and worry as stock prices fall and others around them sell their positions. The dip facing the stock market in September is having that effect -- with topics like inflation, the Federal Reserve's next move, and the ongoing pandemic on people's minds. 

But investors would be wise to stay focused on the long term. Use the market's pessimism to buy shares of high-quality companies that you plan to own for many years to come. Home Depot (HD -1.44%) and Starbucks (SBUX 0.29%) fit the description and are two "forever" stocks you should take a look at right now. 

Person using trading app on smartphone.

Image source: Getty Images.

The robust housing market is driving demand for this top retailer 

Home Depot's business has been on an absolute tear since the start of the pandemic with sales rising more than 20% in each of the previous four quarters before increasing 8.1% in the most recent three-month period. Last year, stuck-at-home consumers focused their attention -- and dollars -- on renovation projects. And the U.S. economy, characterized by historically low interest rates and dealing with a shortage of housing supply, only supports Home Depot's prospects. 

What makes the business a "forever" stock is its ability to defend against the threat of e-commerce, particularly from the likes of a behemoth like Amazon. In 2017, Home Depot launched a multi-year, $11-billion investment initiative to bolster its supply chain and omnichannel capabilities, catering primarily to the demands of professional contractors. These valuable customers need tools and supplies quickly in order to get back to the job site, finish projects, and support their own small businesses. They often don't have time to wait for delivery. So it's no wonder that in the most recent quarter, 55% of online orders were fulfilled through Home Depot's 2,298 stores. 

Compared to smaller rival Lowe's, Home Depot sports superior financial metrics. That includes a strong operating margin (16.2%), stellar sales per square foot ($663), and a remarkable return on invested capital (44.7%). Not only is Home Depot the largest home-improvement chain in the world by sales, but it is one of the best businesses on the planet because of its impressive track record of growing revenue and profit over time, regardless of the macroeconomic environment. 

CEO Craig Menear is extremely confident in his company's continued momentum. "Pros tell us their backlogs are bigger than ever," he said on the recent earnings call. "Consumers continue to tell us the home is more important than ever and that they have a laundry list of projects." Sustained demand for Home Depot's products means adding the stock to your portfolio can provide a safe investment when another market sell-off inevitably occurs. 

Person walking with headphones on and drinking coffee.

Image source: Getty Images.

The world's love of caffeine makes this brand widely recognizable 

Starbucks has grown into a coffeehouse empire on the back of consumers' unwavering infatuation with caffeinated beverages. The stock has been a huge winner over the years, rising more than fivefold over the past decade. During that time, quarterly revenue and profit have skyrocketed 157% and 313%, respectively. And the store count has soared to a whopping 33,295 today. 

While the pandemic caused temporary store closures, subsequent reopenings have allowed the company to return to growth. "Starbucks delivered record performance in the third quarter, demonstrating powerful momentum beyond recovery," CEO Kevin Johnson said in the company's latest earnings release.

Because of those strong results, Starbucks is raising its outlook. For the full fiscal year, management now expects revenue to come in at about $29 billion, same-store sales to expand some 20%, and 1,100 net new store openings. 

Like Home Depot, Starbucks isn't really vulnerable to technological disruption. At the same time, it continues to innovate and develop its digital capabilities. There are now 24.2 million active rewards members in the U.S. -- a 48% year-over-year jump -- who utilize its app and payment option to buy coffee and food. Starbucks' drive-thru, curbside pick-up, and delivery options only further strengthen its place in consumers' minds. 

By 2030, management thinks the company can have 55,000 locations worldwide, an astronomical figure that would make it the largest restaurant chain globally by number of locations. And like many American brands, much of this growth will come from China, where the company has just over 5,000 locations today. About 12% of Starbucks' revenue comes from the Asian nation, a number that is only likely to increase over time. 

With the rapid pace of technological change in today's economy, trying to figure out what businesses will thrive in the future is difficult, if not impossible. But there is one thing of which we can be fairly certain: Caffeine will continue powering people all over the world, making Starbucks a significant beneficiary.