Even prominent companies can sometimes fall out of favor with investors if the goods or services they offer become obsolete. But that's unlikely to happen to the broader healthcare sector, which makes it a good place to look for stocks to hold on to for a long time. Even so, individual companies within the industry must continue innovating to keep up with the evolution of the healthcare market to remain successful over long periods.

Some companies have proven their ability to do that and can continue down the same path for a while. Let's consider two of them: Bristol Myers Squibb (BMY 0.45%) and Novo Nordisk (NVO -0.19%). Both are excellent buy-and-forget stocks. Here's why.

1. Bristol Myers Squibb

Bristol Myers is one of the largest pharmaceutical companies in the world with a portfolio of products that focuses predominantly on oncology and immunology, the two largest and fastest-growing therapeutic areas in the industry. Last year, the drugmaker had seven products that each generated more than $1 billion in revenue. And of those, six grew their sales on a year-over-year basis.

The one that did not was cancer drug Revlimid, which started facing generic competition last year, leading to a drop in revenue for the medicine. Revlimid was Bristol Myers' top-selling product before last year. That, combined with the negative effect of currency exchange fluctuations, explains why Bristol Myers' top line dropped slightly in 2022. The company's revenue was $46.2 billion, about half a percent lower than the previous fiscal year.

Bristol Myers' revenue increased by 3% year over year in constant currency. The company's adjusted earnings per share rose by 8% year over year to $7.70. Last year was also important for Bristol Myers as it earned some key approvals that will help it replace Revlimid and other older products that have lost patent exclusivity. That includes plaque psoriasis medicine Sotyktu and Camzyos, which treats a heart disease.

Last year, Bristol Myers' new product portfolio, which includes medicines approved as far back as 2019, generated about $2 billion in sales, an increase of 87% year over year. And putting aside recent products that have lost patent exclusivity, the company's top line jumped by 9% year over year. That will soon become something close to the norm for Bristol Myers once older therapies cease to affect its financial results.

Furthermore, the company should earn approval for newer ones, thanks to a large pipeline with more than 50 clinical compounds in development.

Bristol Myers' ability to navigate patent cliffs is a crucial reason it can succeed in the long run. Here's another thing that makes its stock attractive: the dividend. The company's 3.45% yield is competitive, and it has raised its payouts by 42.5% in the past five years, or an average of a little more than 8% per year. Income-seeking investors can't go wrong with this stock, and neither can patient investors looking for a reliable company to invest in for good.

2. Novo Nordisk 

Based in Denmark, Novo Nordisk has made a name for itself in the market for diabetes medicines. It is one of the few drugmakers that dominate this therapeutic area. Novo Nordisk is arguably the leader of the pack. It held a 46.7% share of the insulin market in November, although that decreased slightly by 0.5% compared to the year-ago period. Elsewhere, Novo Nordisk registered a 54.9% share of the glucagon-like peptide 1 (GLP-1) agonists market, an increase of 2.2% year over year.

GLP-1 agonists help type 2 diabetes patients control their blood glucose levels and lose weight. Novo Nordisk's diabetes care market share was 31.9% as of November, 1.8% higher than the year-ago month. The company has continued to innovate in this area while also looking to diversify its lineup. One of the its most promising products is icodec, a potential once-weekly insulin that has produced excellent results in clinical trials.

Novo Nordisk plans to submit applications to regulatory agencies for icodec in the U.S. and China (a market with 120 million diabetes patients) in the first half of the year. Patients typically take insulin daily. A once-a-week option is much more convenient, reduces human error risk, and could help patients achieve better outcomes while simplifying their lives. So if approved, icodec will without a doubt attract a large number of patients.

In the meantime, Novo Nordisk is awaiting approval for brand-new products for which it submitted applications in the U.S. last year. This includes concizumab, a potential hemophilia therapy, and nedosiran, an investigational treatment for primary hyperoxaluria, a rare genetic condition that causes kidney and bladder stones. Novo Nordisk boasts many more programs, a lot of which are related to diabetes or obesity. Others target rare diseases and not-so-rare ones, including Alzheimer's, which has largely eluded researchers for a long time.

That's in addition to the company's current lineup, which is still performing well. Novo Nordisk's revenue in 2022 jumped by 26% year over year to 177 billion Danish kroner (about $25.1 billion). The company's net income was 55.5 billion DKK ($7.8 billion), 16% higher than the previous fiscal year. Expect the company to generate similarly impressive financial results regularly as it maintains a solid lead in diabetes and increasingly ventures into new therapeutic areas.