The S&P 500 and Nasdaq both reached fresh all-time highs recently, and while some stocks in the market are starting to look a bit expensive, there are still excellent opportunities to be found.

Here are two stocks I own in my personal portfolio that aren't quite as cheap as they were a year ago but could be tremendous long-term investment opportunities at their current prices.

An e-commerce powerhouse that will only get stronger

There is a lot more to Shopify (SHOP 1.11%) than simply facilitating online stores. It offers payment processing, capital (lending) services, shipping, POS solutions, the Shop Pay online checkout platform, and much more. The stock is still a long way off from its 2021 high, but it isn't a cheap stock by any definition of the word at 75 times forward earnings and about 13 times sales. However, its latest results show why it could be worth every penny of its current share price.

For starters, the company has done an excellent job of rightsizing and refocusing its operations, and it shows. In the fourth quarter, gross merchandise volume (GMV) on Shopify's platform was up 23% year over year to $75.1 billion, and thanks to its ever-expanding portfolio of services, monthly recurring revenue grew by 35%. With an 81.5% gross margin on subscriptions, this is excellent growth in the right place.

Looking ahead, Shopify's management expects first-quarter revenue growth in the "mid-to-high 20s," and said it expects free cash flow margins to improve in every quarter. With excellent progress in some of the most promising areas of the business, and a rapidly growing ecosystem of e-commerce tools businesses need, Shopify is one stock I'd buy even while the market is near its all-time high.

Iconic assets and lots of room to grow

Ryman Hospitality Properties (RHP 0.09%) is a real estate investment trust, or REIT, that invests in two types of properties. The larger component of the business is Ryman's six large-scale hotels, five of which are operated under the Gaylord brand, and all of which focus on group travel, conferences, meetings, and conventions.

In addition, Ryman has a portfolio of entertainment assets, including the namesake Ryman Auditorium and Grand Ole Opry in Nashville, an entertainment complex in Austin, and the fast-growing Ole Red dining and entertainment chain, which just opened its flagship location on the Las Vegas Strip.

To put it mildly, the group-focused hotel business is strong. In 2023, Ryman produced its highest revenue and operating income from its hotels ever, and future room night bookings have been excellent. And on the entertainment side, Ryman saw 21% year-over-year revenue growth. Plus, the flagship Ole Red opened after the end of the year, and there's a massive entertainment complex in partnership with country star Luke Combs currently under construction, so 2024 could be even stronger.

Ryman is also investing heavily in capital improvements to its properties, and the future is looking incredibly bright. Even with shares near an all-time high, Ryman trades for less than 15 times forward funds from operations (FFO -- the real estate equivalent of "earnings") and has a 3.8% dividend yield.

Buy for the long term

These are two very different businesses, but one thing they have in common is their long-tailed growth potential. Shopify still has a ton of room to not only expand its reach, but to build its relationships with current customers for years to come. And in Ryman's case, there's massive potential to expand both its hotel and entertainment businesses.

To be clear, I have no clue what these stocks will do over the next few months, but I'm confident I'll be happy I have them in my portfolio a few years from now.