The stock market has proven its ability to build wealth time and time again. However, patience is required, and investors seeking to realize optimal returns over the long term will need to contend with the ups and downs that the market inevitably presents. 

If you have the capital to invest in the stock market, and a long-term buy-and-hold horizon, there is no shortage of incredible companies begging to be bought right now. Assuming your retirement is at least a decade or more away, here are two fantastic companies that could foreseeably multiply an initial investment by five times or greater over the coming years and help you move closer to your retirement goals.

1. Upstart

Upstart (UPST 0.79%) built a business around an idea designed to revolutionize the lending space. Rather than relying almost exclusively on the FICO score to determine loan approvals or denials -- a process that has historically left significant swaths of the potential creditworthy population out of the picture -- Upstart's AI and machine learning-based platform leverages more than 1,000 unique data points to assess whether or not a consumer should be approved for a loan.

This process has not widened the total addressable market of creditworthy consumers, but Upstart's platform has been able to approve 173% more loans than traditional U.S. banks with the same default rate. No wonder Upstart is continuing to see its network of lending partners jump on board in droves, despite the fact that institutional investors are funding fewer loans in the current environment, where interest rates are higher -- as is risk of default. It's also important to point out that Upstart's platform constantly learns and adjusts to the environment at hand. So when the risk of default is elevated, it's naturally going to approve fewer loans, and the loans it does approve will have higher rates of interest assessed. 

As of the end of 2022, approximately 82% of loans processed through Upstart's platform were fully automated. Upstart closed out the 12-month period with 120% more credit union and bank partners and 90% more auto dealers inducted into its network than at the end of the prior year. The auto lending market alone -- one in which Upstart is continuing to make significant inroads, with names like Mercedes Benz adopting its auto retail software to simplify everything from auto loan applications to contract processing -- represents a space valued at $780 billion.

Investors will need to be patient with this fintech stock. However, as interest rates eventually go down and institutional appetite to fund loans recovers, Upstart looks positioned to capitalize on this long-term trajectory. 

2. Vertex Pharmaceuticals 

Vertex Pharmaceuticals (VRTX -1.02%) is a company that has long blazed its own unique trail in the world of healthcare. This goes back to its dominance of the lucrative cystic fibrosis treatment market, a space in which it remains the only company with approved drugs that treat the underlying cause of the genetic disease. Even with this unmatched market footprint, management believes that there are upwards of 20,000 people globally that could take its medicines but aren't doing so yet, and at least another 5,000 cystic fibrosis patients that require a different type of therapy to target their underlying mutation. 

Vertex Pharmaceuticals continues to garner expanded approvals for its existing portfolio of cystic fibrosis drugs, thereby expanding the target area of its multi-billion-dollar total addressable market. At the same time, it's also working on another cystic fibrosis drug for that latter group of patients that can't take its existing portfolio of products, an mRNA-based candidate that it's co-developing with Moderna

Bear in mind, the rare disease drug market is a vast space, and one which Vertex is working hard to penetrate with a growing pipeline of potentially revolutionary therapies. One example is exa-cel, a candidate that could be approved as soon as this year and be a one-time functional cure for two rare blood disorders. It's also working on a non-opioid drug candidate for acute pain.

The company even has multiple stem-cell based treatments for Type 1 diabetes in the works. Vertex Pharmaceuticals' history of profitability and revenue growth combined with its lucrative portfolio of drugs have placed it in an ideal position to expand its market leadership in new areas, and investors who buy in now could be poised for strong portfolio returns over the long term.