Most businesses don't even last 20 years, so finding companies worth investing in for a lifetime is no easy task. But the reward is well worth it as the combination of time and compounding can turn a modest initial investment into a hefty sum. And the best part is that investors can get started with just $100.

Let's look at two companies whose shares are trading for less than that and are worth holding on to for good: Bristol Myers Squibb (BMY -1.57%) and Shopify (SHOP -3.15%)

1. Bristol Myers Squibb

Companies that can stand the test of time tend to offer goods or services that are always in need. That's true for Bristol Myers Squibb. As a leading pharmaceutical company, it boasts a portfolio of drugs that is especially focused on oncology and immunology. And it's constantly working at developing newer and better medicines.

We are seeing that in action right now. In the first quarter, Bristol Myers' revenue declined by 3% year over year to $11.3 billion as some of its key products have lost patent protection relatively recently. But sales of the drugmaker's new products, combined with those that have yet to fall off the dreaded patent cliff, increased by 8% year over year. 

This signals that as the effect of Bristol Myers' older products on its top line fades, the company should start growing its revenue at a good clip again. Of course, the company isn't finished adding new products or earning label expansions. Bristol Myers has more than 50 compounds in development and several dozen ongoing clinical trials. 

While not all of them will lead to approvals (no pharmaceutical company has a perfect track record), many will. Over the long run, expect Bristol Myers to strengthen its portfolio and deal with patent cliffs adequately, as it has before. Meanwhile, with an aging world population, the need for lifesaving medicines will only grow in the coming years since people need more medical services in their golden years.

That puts Bristol Myers in an excellent position to remain a leading pharmaceutical giant for a long time. And then there is the company's excellent dividend profile. Bristol Myers has increased its payouts by some 43% in the past five years. The stock currently offers a yield of 3.52% and a payout ratio of nearly 42%, which shows that the company's cash generation more than covers its dividend, leaving ample room for further hikes. 

It's just one more reason Bristol Myers is an excellent stock for risk-averse investors with a long time horizon. 

2. Shopify

Shopify has made a name for itself as a go-to option for people seeking to create an online storefront from scratch. The company provides a suite of services and features; perhaps most notably, developers have built hundreds of applications in Shopify's App Store designed to improve merchants' experience by adding additional functionalities to their websites. Shopify's platform is highly versatile, making it a leading player in this niche.

Recently, the company decided to shift away from its expensive logistics operations to focus on its core business of offering an e-commerce platform to merchants. The move should help decrease Shopify's costs and improve margins and efficiency. And given Shopify's already strong position in the industry -- it held a 10% share of the U.S. e-commerce market by gross merchandise volume as of the end of 2022 -- the company should be able to profit from this fast-growing industry.

Though much of retail activity has moved online, plenty of white space remains. E-commerce accounted for just 15.1% of total retail sales in the U.S. in the first quarter. The industry is much less penetrated in many places worldwide, which is excellent news for Shopify and its shareholders. It could be several decades before the sector reaches its peak across the globe.

In addition to the solid reputation it has developed in its niche, Shopify's platform benefits from high switching costs since choosing to jump ship to a competing e-commerce website for merchants often means foregoing the time, effort, and money it took to build one on Shopify. That's why Shopify's merchant count has generally increased, as has its revenue.

Shopify's new shift in strategy should help it achieve consistent profitability much sooner than it otherwise would have while it continues to increase its top line at a good clip -- all while delivering excellent returns to investors.