With freight demand robust this year, American railroad companies are taking advantage of greater volumes combined with higher rates. Although steady demand for freight transportation is expected to continue, the railway industry also faces near-term supply chain disruptions, labor shortages, and soaring fuel prices.

Railroad companies that can endure the current economy with minimal damage stand to benefit greatly over time, especially considering rail is the most economically and environmentally friendly way to transport goods and materials across the U.S. 

Let's take a closer look at two major American railway players and determine which of these railroad stocks makes a better buy in today's market.

1. Union Pacific

Union Pacific (UNP 0.26%) operates 32,000 miles of track across 23 states in the western two-thirds of the U.S. As a historic American railway, Union Pacific has transported the country's coal, agricultural products, shipping containers, and other freight since 1862. As a member of the prestigious Fortune 500, the Omaha-based company remains a pillar of the rail industry.

After posting third-quarter records for operating revenue, operating income, net income, and earnings per share, Union Pacific certainly seems to be on the right track. However, a shift in consumer spending from goods to experiences recently triggered a 16% drop in parcel shipments for the rail carrier. 

And although volumes were actually up in Q3, staffing shortages left a substantial amount of business on the table for Union Pacific. Despite crew setbacks, CEO Lance Fritz is confident that hiring initiatives and enhanced training programs will dig the company out of its staffing hole. According to Fritz, although 2022 hasn't exactly been ideal, Union Pacific's volumes have nevertheless "outpaced" peers throughout the year. 

Union Pacific now looks to carry its current momentum in coal, autos, and construction materials shipments into 2023. To improve profitability, Fritz and his team pursue streamlined operations, better fleet management, faster train speeds, and -- above all -- increased volumes.

2. CSX

Also a member of the Fortune 500, CSX (CSX -0.58%) serves every major city in the eastern U.S. In addition to energy-related, industrial, construction, agricultural, and consumer freight, CSX also runs a small number of passenger trains.

Like Union Pacific, CSX has struggled with crew shortages in recent quarters. The Jacksonville, Florida-based railway's on-time departures fell 13% in the third quarter, and on-time arrivals dropped 16% year over year. However, things are improving at CSX, with over 6,800 crew members hired out of a 7,000-hire goal. Vice President of Operations Jamie Boychuk affirmed that train speeds and capacities will continue to pick up once hiring and training are complete.

CSX's new CEO, former Ford Motor Company executive Joe Hinrichs, seeks to enhance existing railway operations by focusing on service and reliability. Hinrichs' simplified, holistic approach centers on improving CSX's core competencies to scale operations. Once the railroad operator earns a track record of reliable, predictable service, CSX should attract new business organically while retaining and growing its existing accounts.

Undeterred by staffing concerns, CSX grew volumes by 2% in Q3, while the railway earned 18% more revenue and 15% more profit than in 2021. As underscored by Boychuk during the Q3 earnings call, CSX could stand to see substantial growth -- both in volume and profitability -- once fully operational. 

Which railway stock is a better buy right now?

To determine which of these railway stocks makes a better buy in today's market, let's compare their price-to-earnings ratios and dividend yields.

Metric Union Pacific CSX
Market cap $129.2 billion $66.5 billion
Price-to-earnings ratio 18.74 16.83
Dividend yield 2.47% 1.26%

Table data: E*Trade.

Although it has a higher price-to-earnings ratio, Union Pacific does have a greater dividend yield, a benefit for income investors. In my opinion, the higher yield makes Union Pacific today's winner. However, both of these iconic operators stand to benefit from a railway industry poised for long-term growth.