Crude oil prices have largely been above $100 per barrel for around four months now. Compare that to the low prices of two years ago, when they temporarily fell into actual negative territory. This is just one case that highlights the highly volatile nature of oil prices.

Yet if you have a long-term investment horizon and select your stocks judiciously, you could do very well with your energy investments. Let's look at two energy stocks to buy and one to avoid this month.

Two energy stocks to buy

The performance of oil and gas companies (and, in turn, their stock prices) is largely tied to oil prices. As such, prices of energy stocks tend to be volatile. Consider the wild swings in the shares of two natural gas providers, Williams Companies (WMB -0.27%) and ONEOK (OKE 0.26%).

WMB Chart

WMB data by YCharts

The chart above shows the price change of Williams and ONEOK shares over two decades. In addition to wild swings, the price gains of the two stocks were quite decent during this period. However, the picture changes dramatically when we consider their total returns.

WMB Total Return Level Chart

WMB total return level. Data by YCharts.

As this second chart shows, Williams and ONEOK outperformed the S&P 500 by even more over a period of two decades. Dividends can really make a difference, and today both stocks offer attractive dividend yields of 5.3% and 6.6%, respectively. And ONEOK has grown its dividend for more than 25 years in a row.

WMB Dividend Per Share (Quarterly) Chart

WMB dividend per share (quarterly). Data by YCharts.

Williams Companies had to cut its dividend in 2016, following an extremely challenging commodity environment. However, the company is steadily increasing it again. Fee-based contracts and strategically located assets are largely behind the steady earnings growth of both Williams and ONEOK over the years.

Energy markets could turn challenging at any time. That means investors might incur losses if they need to sell their shares when commodity prices aren't supportive. But if you are looking to invest for the long term while earning a steady dividend stream, Williams Companies and ONEOK look like solid stocks to consider right now.

One stock to avoid: Energy Transfer

Now, let's look at Energy Transfer LP (ET 1.97%). While the natural gas pipeline company posted impressive performance in the last couple of quarters, my reasons to avoid this stock are more long term.

The first has to do with corporate-governance issues at the company. Energy Transfer has been in a long-running legal dispute with Williams Companies, which it was going to purchase over five years ago, but the deal never went through -- and finally in late December of last year, a court ordered Energy Transfer to pay Williams $410 million for backing out of the deal.

The second reason to avoid Energy Transfer stock is the company's lack of a consistent commitment to its dividend. After an indirect distribution cut, through the roll-up of Energy Transfer Partners in 2018, the company again cut its dividend in 2020. Surely, the step helped it regain its balance-sheet strength. However, the need for the cuts might not go down well with dividend investors.

Lastly, as a master limited partnership (MLP), Energy Transfer issues K-1 tax forms. Some investors don't like the additional hassles associated with these forms. Overall, there clearly are better opportunities than Energy Transfer in the energy sector right now, like the ones discussed above.