Warren Buffett has said, "It's far better to buy a wonderful company at a fair price than a fair company at a wonderful price." So we shouldn't necessarily wait for bargain-basement prices for stocks -- but it doesn't mean we should pay big premiums for stocks, even if the companies are clearly powerhouses.

It's generally best to aim to buy stocks when they're undervalued, in order to bake in a margin of safety. Even great stocks can drop in value over the short term, especially if they were overpriced. Here, then, are three companies that are looking rather richly valued these days.

1. Waste Management

Waste Management (WM -1.22%) is the 800-lb. gorilla in the trash and recycling world, describing itself like this: "WM has the largest disposal network and collection fleet in North America, is the largest recycler of post-consumer materials and is the leader in beneficial reuse of landfill gas, with a growing network of renewable natural gas plants and the most gas-to-electricity plants in North America. WM's fleet includes nearly 11,000 natural gas trucks -- the largest heavy-duty natural gas truck fleet of its kind in North America -- where more than half are fueled by renewable natural gas."

The S&P 500 is down nearly 21% from its 52-week high at the time of this writing, and gobs of companies have seen their shares swoon hard, too. But Waste Management's shares are only down 9%. That drop makes the shares more attractive, but they're not near bargain territory: The company's price-to-earnings (P/E) ratio was recently near 29, very close to its five-year average, and its price/earnings-to-growth (PEG) ratio was 2.5, well above a score of 1.0, which would traditionally suggest fair value.

Don't completely write off Waste Management, though, because it's a solid, dependable grower that has averaged annual share-price increases of more than 18% over the past decade. In the company's third quarter, revenue grew by 8.8% year over year, while net income rose 18.8%. It pays a dividend, too, which recently yielded 1.67%. Consider adding it to your watch list.

2. UnitedHealth Group

UnitedHealth Group (UNH 0.30%) is a powerhouse in the healthcare industry, recently reaching a market value north of $500 billion. Its workforce of more than 300,000 people serves customers in all 50 states and in scores of countries, processing more than a trillion digital transactions each year.

Despite its massive size, UnitedHealth is still able to grow at a respectable clip. In its third quarter, revenue increased 12% year over year to $81 billion, while net profit margin grew to 6.5% from 5.6% a year earlier.

Shares have risen by an annual average of more than 26% over the past decade, and at recent levels, they appear overvalued. Its P/E ratio, for example, was recently near 27, well above its five-year average of 22, and its PEG ratio was 1.66, topping the five-year average of 1.5. UnitedHealth's dividend recently yielded 1.23%, and it has hiked its payout for 13 years in a row. This is another company you might steer clear of for now. But consider keeping an eye on it for a lower entry price, if you're interested.

3. Ulta Beauty

Ulta Beauty (ULTA -0.40%) has grown into the largest beauty retailer in the country, with a recent market value topping $21 billion. It recently listed more than 1,300 retail locations in all 50 states, selling cosmetics, fragrances, skin care products, hair care products, and salon services. It has a busy e-commerce site as well.

In Ulta's second quarter, revenue grew by 16.8% year over year to $2.3 billion, while net income grew by 17.8% and the company added seven net new locations. It's investing in new technology and new ways to serve customers, such as same-day delivery.

Ulta's stock is also looking richly valued these days, with its PEG ratio recently at 1.76. That's below the five-year average of 2.16, but it's still not exactly cheap.

Opinions always differ on just about every stock, and some will see one or more of the three stocks above as trading at attractive levels. Do your own digging and see what you think. If you're not sure, you might just add them to your watch list or buy into them gradually, in increments over time.

It's true that any of them might perform terrifically from recent levels, but they don't offer much of a margin of safety. Your own risk tolerance might determine what you do.