The most important factor to consider when picking stocks to hold for a 20-year time frame is a company's staying power against competition. Lots of growth and high returns in the near term won't mean much if a company fizzles out in the long run.

With that said, let's look at two outstanding companies that should be around and able to fend off the competition for decades.

Costco Wholesale

Investors looking for a quality stock they can park some money in for a long time should consider Costco Wholesale (COST 1.01%). It's a no-brainer. The company has a solid record of profitable growth and paying dividends to shareholders. Over the last decade, the stock delivered a return of 489%, including dividends. Growth in sales and earnings per share of 9% and 13% per year, respectively, fueled these market-beating returns.

Costco enjoys a rock-solid business model of keeping costs down to pass the savings on to customers -- a strategy that inherently makes it very difficult for another retailer to knock it down. In return, Costco earns a steady stream of revenue from membership fees, which generate most of the company's net profit. 

There's no retail business that out-competes Costco on keeping prices as low as possible. The company is relentless in eliminating unnecessary costs from corporate overhead through the supply chain. As a retailer, it's smart to run a business this way. Low prices keep customers coming back, and that makes shareholders happy in the long run.

Even with high inflation pressuring sales at many retailers over the last year, Costco has kept generating growth in comparable sales, a key performance metric that measures the change in sales for stores that have been open at least one year. In the most recent quarter, Costco reported an increase in comparable sales of 3.5%, excluding changes in gas prices and currency.  Naturally, people are going to shop at Costco when everything is getting more expensive.

While Costco stock has performed well for investors through the pandemic and recent macroeconomic headwinds, investors are probably wondering how much growth is still left in the tank, especially with the company now operating in almost every state. The good news is that it still has ample opportunities to expand internationally in Mexico, Europe, and Asia. 

Another opportunity with enormous potential is e-commerce. Online sales made up only 7% of Costco's total sales in fiscal 2022, ended in September. Despite recent weakness in its online business, Costco has a lot of potential to be a major player in e-commerce like Walmart, where online sales have grown to make up a much bigger percentage of its business.

Airbnb

Costco is a solid long-term holding, but you might be looking for a stock with a bit more juice without sacrificing long-term stability in the business. Airbnb (ABNB 0.75%) is a good choice. The stock is slightly down from where it started trading a few years ago, but the company is still posting solid increases in revenue and profits that make it only a matter of time before the stock reaches new highs.

Airbnb's results this year show why it's built for success. Revenue grew 18% year over year in the second quarter, and it has more than doubled from the same quarter before the pandemic. Because Airbnb generates revenue from service fees, the company reported a healthy profit in the second quarter of $650 million on $2.5 billion of revenue. 

Airbnb benefits from a large pool of hosts that have listed over 7 million properties on the platform, up from 6.6 million at the end of 2022. As more people go to Airbnb, it attracts more listings from hosts looking to make extra money, which, in turn, spreads a large net to capture a greater share of worldwide travel spending.

One trend that should continue to drive growth over the next several years is remote work and long-term stays, which now represents 18% of total nights booked on the platform.

Most importantly, Airbnb is regularly releasing new upgrades to the platform that offer new services and features. The company has a very profitable business model to reinvest in future opportunities, such as implementing artificial intelligence throughout the company to improve efficiency in customer service and other areas. 

The strong growth in the business has pushed the stock up 55% this year. It should grow for a long time, considering it is serving a growing travel and tourism industry worth $854 billion, according to Statista. As a leading platform with increasing brand awareness, it should be a rewarding investment for the next 20 years, and perhaps even longer.