Apple is soaring, but is Google a better buy?

It costs Apple $220 to build the iPhone SE
It costs Apple $220 to build the iPhone SE

Remember when Alphabet, the parent company of Google, passed Apple to become the world's most valuable company?

Yeah. Me neither.

Alphabet (GOOGL) briefly inherited the biggest market cap crown in early February. But Apple (AAPL) has since roared back to life, gaining about 20% since hitting its lows point for the year on February 11.

Apple's shares are up 4% year-to-date and the company is now worth about $610 billion -- nearly $90 billion more than Alphabet.

So much for Alphabet beating Apple to the $1 trillion mark?

Perhaps. Both still have a long ways to go before they get there. Some analysts think there's a good argument for each company to continue outperforming the rest of the tech sector and broader market.

Related: Apple could be radically redesigning the iPhone

Apple's resurgence comes at an interesting time for the company.

It had been in the middle of a privacy battle with the U.S. government over access to the iPhone used by one of the gunmen in December's San Bernardino terrorist attack. But the FBI recently said it found a way into Syed Farook's phone without Apple's help.

Apple also recently released the iPhone SE -- its first four-inch model since the 5S came out in 2013. (Haters of increasingly bigger smartphones rejoice!) And Apple may soon be able to claim that it has sold its billionth iPhone.

So Apple's comeback makes sense. The stock was arguably way oversold due to concerns that iPhone sales were peaking.

But it would be a mistake to underestimate Alphabet -- which I (and the analysts I quote) will still occasionally refer to as Google during the rest of this story. (Old habits die hard. Sorry, Larry Page!)

Colin Gillis, an analyst with BCG, said that Apple's rebound is impressive. But it may mean that there's little upside left in the stock at this point.

Related: Google Play removes app made by the Taliban

He argues that Google has a better track record with the higher profit margin software and services businesses than Apple, which he believes is still essentially a hardware play. So Apple is more dependent on upgrade cycles for its phones, tablets and Macs.

"If you could only buy one stock, it's Alphabet," Gillis said. "Longer-term, Google is still better positioned than Apple to build its services and software businesses."

Gillis has a price target of $110 for Apple -- barely above its current price. His price target for Alphabet is $900 -- about 20% higher than where it is trading now.

But Ivan Feinseth, an analyst with Tigress Financial Partners, said he actually likes Apple a little more than Alphabet at these levels. However, he added that investors may not have to choose one over the other. He thinks both look attractive.

"They are each good values. Alphabet has more going on because it's more diversified." he said. "But both companies have a lot of cash to acquire things. And while Apple may be a one-trick pony with the iPhone, it's a good pony."

Gillis agreed that rumors of the iPhone's demise were probably exaggerated.

"The SE is going to fill a nice hole. There is enthusiasm about the iPhone again. And people are looking forward to the iPhone 7 later this year as well," Gillis said.

So even though Apple's stock may have gotten a bit ahead of itself, you shouldn't count it out just yet either.

CNNMoney Sponsors