Your time horizon matters when it comes to investing. 

GlaxoSmithKline's (NYSE:GSK) stock performance, for example, has handily outperformed Eli Lilly's (NYSE:LLY) so far in 2018. It's a much different story over the last three years and five years, though, with Lilly gaining a lot more than Glaxo.

But which of these pharma stocks is the better pick for investors with a long-term perspective of 10 years or more? Here's how GlaxoSmithKline and Eli Lilly compare.

Sneakers in front of left and right arrows on ground

Image source: Getty Images.

The case for GlaxoSmithKline

Perhaps the best argument for buying GlaxoSmithKline stock is that there's a "new Glaxo." Sure, the company still faces the prospects for continued sales declines of big winners of the past. However, GlaxoSmithKline claims a stable of newer products.

The company's four Ellipta respiratory drugs -- Anoro Ellipta, Arnuity Ellipta, Incruse Ellipta, and Relvar/Breo Ellipta -- posted strong sales growth last year. Combined with similarly solid momentum for Nucala, GlaxoSmithKline's newer respiratory drugs more than offset the slump in sales for top-selling drug Advair.

GlaxoSmithKline has also made tremendous progress in the HIV market. The company's Viiv Healthcare spinoff has two HIV blockbusters, Tivicay and Triumeq. Sales for the two drugs jumped 40% and 35%, respectively, in 2017.

Two of the most promising new drugs in Glaxo's lineup are shingles vaccine Shingrix and lung cancer drug Trelegy. Shingrix is expected to reach peak annual sales topping $1 billion. Trelegy should also become a blockbuster drug for the company.

Much of the GlaxoSmithKline's management team is also new. CEO Emma Walmsley has only been at the helm a little over a year. She has shaken up the company's executive team, replacing around 40% of Glaxo's upper ranks.

Glaxo is also expanding its presence in consumer healthcare. The company recently announced a $13 billion deal to buy out its partner Novartis in a joint venture focused on consumer healthcare. Earlier this year, GlaxoSmithKline had seriously considered buying Pfizer's consumer business, but it ultimately backed out of the running

One thing that hasn't changed with the "new Glaxo" is its juicy dividend -- at least not so far. The dividend yield currently stands above 6%. 

The case for Eli Lilly

Why buy Eli Lilly? We can use some of the same arguments in the investing case for GlaxoSmithKline. 

Like Glaxo, Lilly claims several new products that are driving growth. Trulicity stands at the top of that list. In a little more than three years on the market, the diabetes drug has topped the $2 billion sales mark. Jardiance and Trajenta are other diabetes drugs in Lilly's lineup with solid momentum.

While Lilly has been a longtime leader in diabetes, the company has stepped up to the plate in another therapeutic area. Taltz won FDA approval in 2016 for treating plaque psoriasis and in late 2017 for treating psoriatic arthritis. The drug appears to be on track to become yet another blockbuster for Lilly.

Earlier this year, Lilly CEO Dave Ricks stated that the "next chapter of growth" for Lilly will be in treating pain. Ricks was particularly referring to three late-stage candidates in Lilly's pipeline: galcanezumab, lasmiditan, and tanezumab. The company hopes to receive FDA approval for galcanezumab in treating migraine in 2018. Lasmiditan could be submitted for approval in treating migraine later this year. Lilly and partner Pfizer expect to announce late-stage results for tanezumab in 2018 as well.

Where GlaxoSmithKline opted to beef up its presence in consumer healthcare, Lilly is looking to possibly exit one of its businesses. The company is exploring a potential sale or spin-off of animal-health unit Elanco. This could provide a significant amount of cash that Lilly could use to fund more acquisitions and licensing deals that bolster its drug pipeline.

Lilly's dividend yields a little under 3%. The company appears to be in good shape to keep the dividend checks flowing. 

Better buy

I think that Lilly is the better buy between these two stocks. In my view, Lilly has better growth prospects than GlaxoSmithKline. While Lilly's diabetes drugs face tougher competition in the future, I agree with Dave Ricks that the company should have a big opportunity in treating pain.

And although Glaxo's dividend yield is higher than Lilly's, I'm not sure how long the British drugmaker will be able to hold off cutting its dividend. Lilly's dividend seems like a safer bet to me.