Are you looking for a stock that you can rely on for the next few decades? It's hard to see that far into the future, but there are some key characteristics that you should prioritize for ultra-long-term holdings.

The perfect stock for this role would have a combination of growth potential and stability. Industry leaders with wide economic moats and exposure to long-term macro growth trends are attractive in this regard. These trends could include cloud computing, data analytics, cybersecurity, the Internet of Things, and disruptive fintech. Products and services with high switching costs and long replacement cycles are even better, because it simply takes longer for incumbents in these areas to be dethroned. Those are the types of companies that are going to be around for a while, delivering growth for investors.

If you're looking for a great stock to hold in your 401k or your Roth IRA, consider these three stocks to buy and hold.

Robot hand holding cash

image source: Getty Images

Amazon

This one is obvious, and popular enough that it almost feels like cheating to include on this list, but Amazon (AMZN -1.64%) is too good a fit for this role to ignore. Consumers are well aware of the company's dominance in e-commerce. Amazon has nearly 50% of the U.S. e-commerce market, which dwarfs its next largest competitor's market share. Online retail has grown rapidly for the past decade, and the pandemic drastically accelerated the trend. All the while, Amazon has established a fearsome competitive advantage, with unmatched logistics, the network effect, an enviable brand, and sheer scale. E-commerce isn't going away, and it would take years to supplant Amazon, even as a wider array of competitors enter the space.

That's a fantastic narrative on its own, but Amazon has shrewdly expanded into leadership positions in other growth verticals. AWS leads the global cloud service market with nearly $13 billion in quarterly revenue. The company's cloud revenue is growing just shy of 30% annually, and the catalysts for this segment will be strong for the foreseeable future due to digital transformation and ubiquitous connectivity.

Amazon is also a major player in the future of entertainment. Prime doubles as a streaming service for movies, shows, music, and live sports, with more than 150 million active users. It's hard to find another company with this level of dominance in multiple growth industries. I'm happy to pay an enterprise-value-to-EBITDA multiple of 31.2 for this sort of stock, especially amid today's high valuations.

Veeva Systems

Veeva (VEEV -0.29%) offers cloud-based software products and services that are used by more than 900 customers in the life sciences industry. Those products and services support numerous essential functions for pharmaceutical and biotech companies, including clinical trials, data management, regulatory compliance, quality control, and customer relationship management. Veeva dominates the life sciences cloud CRM market, which puts it in a fantastic position for the foreseeable future.

Veeva has been growing more than 25% over the past three years, and there's no reason to assume that will stop. Pharmaceutical and biotech are both likely to continue expanding, and tech is going to play an increasing role in the development and marketing of those products. Data analytics and AI are going to help these companies minimize expenses and improve patient outcomes, and the vendors of that tech should prosper. Veeva's scale will allow it to offer disruptive software solutions through internal R&D or the acquisition of smaller companies, and its dominant share of a specialized market will be difficult to erode. Those are great signs for long-term shareholders.

Salesforce

Salesforce.com (CRM -0.18%) offers a broad set of cloud-based customer relationship management (CRM) tools for customers of all sizes from numerous industries. The company's 20% share of the global CRM market is larger than those of its four largest competitors combined. These include heavy-hitters such as Adobe (ADBE 0.89%), Oracle (ORCL 0.22%), and SAP (SAP 0.03%), but Salesforce retains an important competitive advantage: Its broad set of SaaS solutions for marketing applications are critical for the sales operations at many enterprises, and the data collected by the company is increasingly valuable in a world driven by analytics. This creates a unique value proposition, along with high switching costs. That's great news when you're in a growth industry.

Salesforce has also averaged annual revenue growth above 25%. The stock trades at a high premium relative to fundamentals (e.g. earnings, free cash flow, EBITDA), but I think this is a story with strong enough long-term potential that it forces investors to think beyond the next few years. Salesforce should grow into its aggressive valuation, even if it takes a while. It might lead to extra volatility along the way, but that's less relevant when your time horizon is multiple decades.