The stock market can be a treacherous place. At times, it feels like you can't do anything wrong, and you trick yourself into believing you're the best investor of all time. On the flip side, there are periods when nothing seems to go right, and nearly everything is crashing down around you. Many investors have lived through both camps within the past two years and are looking for some more-stable stocks.

While no stock, bond, commodity, or real estate investment is perfectly stable, there are specific examples of some businesses that are more consistent. This is because the products or services they offer are typically used daily and are ingrained in the habits of a large customer base. Two companies that fit this description are Alphabet (GOOG -0.02%) and Costco (COST 0.48%). These two stocks offer safety to investors as many stocks are relentlessly sold off.

Person looking at their computer worried.

Image source: Getty Images.

1. Alphabet

When was the last day you didn't Google something or look up a video on YouTube? It's hard to answer that question because those two activities have become a part of daily life. Both are Alphabet products and have an 86% (Google) and 76% (YouTube) market share in their respective industries. Because of their dominance, advertisers spend heavily on their platforms because they know Google and YouTube attract a wide audience.

This makes Alphabet a relatively safe stock choice in trying times. Even though advertisement spending is known to struggle during recessionary times, its ad mediums are necessary expenses for many companies. If budgets tighten up, I doubt businesses will cut Google spending, since their website would no longer appear at the top of search results in the ad sections. This could further reduce sales, which would be even more exaggerated in difficult times. 

Another factor that makes Alphabet a safer stock is its incredible balance sheet. As of March 31, it held more than $133 billion in cash and securities on its balance sheet against a mere $15 billion of long-term debt. It also produced $15 billion in free cash flow during its first quarter. This amount was even with above-average capital expenditures (capex) for equipment, as last year's first quarter only saw $5.9 billion in capex versus $9.8 billion this year.

Alphabet is also growing steadily, with 23% revenue growth. It maintains a steady 30% operating margin, allowing it to adjust prices without worrying about profitability.

Its combination of consistent growth, a premium product, and a strong balance sheet make it a defensive stock. But it is a great buy today because of its low price-to-earnings (P/E) multiple.

GOOG PE Ratio Chart

GOOG P/E ratio. Data by YCharts.

Alphabet is trading beneath its lowest pandemic sell-off valuation, yet the outlook doesn't seem as bleak as in 2020. Down just over 20% from its all-time high, it is a solid stock pick that will safely provide market-beating returns.

2. Costco

Costco's parking lots always seem to be full of cars. Compare this to other retailers, and it's not hard to see that it is a safe stock. It offers bulk discounts on its products, and consumers rave about its private-label Kirkland brand. Furthermore, now that inflation is rapidly increasing, consumers are stretching each dollar as far as possible. What better way to do that than to buy in bulk?

In its second quarter (12 weeks long, ending Feb. 13), Costco posted 14.4% sales growth. Additionally, its net income rose 36.6% year over year. These results are solid, but they are also par for the course for Costco. The business regularly posts about 10% revenue growth and has done so for the past 20 years.

COST Revenue (Quarterly YoY Growth) Chart

COST revenue (quarterly YOY (growth). Data by YCharts. YOY = year over year.

Costco is a solid business that will deliver consistent results for investors. It also recently reported April sales results, which saw 12.6% comparable-sales growth year over year even with consumer pricing pressures.

While Costco isn't valued as cheaply as Alphabet (it trades for 40 times earnings), best-in-class businesses often trade at a premium and sometimes have to be purchased at high prices. Still, the odds of it collapsing are slim, and the everyday necessities it sells make the company a top "safe stock" pick.

Even though these two stocks have sold off with the market, they are safe long-term equity positions. Alphabet and Costco will recover to new highs and make great investments over the next three to five years with their growing businesses and loyal customers.