The Nasdaq 100 has had an enormous run since the pandemic hit the stock market. Most investors want a piece of that action, but high valuations and market volatility might scare you away from diving into the whole index.

Still, a few of the big Nasdaq stocks are great candidates for long-term investors or retirement accounts. These two can provide a combination of stability and growth to power your portfolio for the long haul.

Amazon

Amazon (AMZN -2.41%) might seem like an obvious inclusion here, but let's take a moment to dissect why it's a stock you can keep in your portfolio for years.

A leader in the highly fragmented e-commerce world, Amazon has roughly 40% of the U.S. market and almost 8% of the global market.

Online sales are almost certain to continue rising as a percentage of total retail sales, and the overall e-commerce market is expected to grow around 10% over the next few years.

The company is sure to experience intensifying competition from all angles. All sorts of brick-and-mortar retailers emerged from pandemic shutdowns with strong digital commerce channels. Smaller direct-to-consumer sellers and niche marketplaces are able to grind out their place in the market, enabled by Shopify and other services.

Even with this competition, Amazon's market share and competitive advantages are so great that it would take a long time for its e-commerce segment to lose value.

Large warehouse with boxes.

Source: Getty Images.

But Amazon isn't just an online retailer. Prime Video is one of the three largest streaming services, with 175 million people streaming video over the past year. Amazon Web Services (AWS) is the global leader in cloud infrastructure services, with more than 30% market share. AWS contributed more than 13% of the company's total revenue last quarter, so it's a major piece of the story that's likely to get even larger. Amazon is even a major player in the grocery store landscape, having acquired Whole Foods and its 500 locations in 2017.

Too much would have to go wrong for Amazon to fail in the short term. It doesn't make a product that can grow obsolete, it's become a diversified giant, and its sheer scale creates advantages over its most capable competitors.

Amazon's competitive advantage and economic moat are considerable, too. Return on invested capital (ROIC) measures how efficiently a company can use its working financial assets to produce profits. Amazon's 16% ROIC is fairly high, especially for a company that prioritizes growth over short-term profits. That indicates a wide moat. It's also evidence of pricing power and efficient operations.

Amazon has more than just staying power, too -- it's still a decent growth play. Its days of explosive expansion are in the rearview mirror, but forecasts still call for 20% growth over the next few years. That's on the tail of last year's 30% growth fueled by consumers shopping from home and increased cloud computing adoption. That forecast makes Amazon's 45.6 forward price-to-earnings (P/E) ratio look far less expensive, with a more modest 2.28 price-to-earnings-growth (PEG) ratio.

At its enormous size, Amazon will likely not be the best-performing stock over the next decade. That title will probably belong to a small-cap stock that will emerge to compete with the big boys. However, Amazon should still outpace the market while delivering enviable stability.

Costco

Costco (COST -0.61%) isn't an exotic tech stock with boundless growth potential. However, it's a good candidate to deliver consistent growth that can outpace the market.

With more than 800 stores across North America, Europe, Asia, and Australia, Costco sells a wide array of consumer staples like groceries, household goods, and clothing. It also carries big-ticket cyclical items such as electronics, furniture, and appliances.

Costco has done great work over the past few years to build out its e-commerce sales channel, which is helping to drive overall growth. It's a truly diverse retailer, which is great for stability. Costco's bulk sales approach and warehouse store model also allow it to offer market-leading prices, so the chain tends to perform well during recessions when households cut back on spending and look for value.

Woman shopping at grocery store in bulk.

Source: Getty Images

Even more exciting for investors, Costco operates with a club membership model. Customers must pay an annual subscription for the right to shop. These fees were equal to nearly 58% of the company's operating profit in the most recent fiscal year, so they are a meaningful contributor to the bottom line. With membership retention above 90%, Costco clearly demonstrates its value to consumers, and its cash flows are much more predictable than those of retailers who rely solely on merchandise sales.

Just like Amazon, Costco boasts an impressive ROIC at 18.2%. That further validates the stability argument, even in a highly competitive environment. Investors should also be drawn to Costco's growth potential. The chain has averaged higher than 10% annual sales growth in recent years, and it's expected to keep up an 8% growth rate over the next two years. You won't get that from Walmart, Target, or BJ's.

Costco's stock is fairly expensive with a 38 forward P/E ratio and 23 enterprise-value-to-EBITDA ratio. That opens the door to slightly larger losses during market downturns, as tends to be the case for stocks with high valuations. Still, these ratios aren't high enough to scare me off from a long-term investment. Costco should easily grow into that valuation if you give it enough time.