CNX Resources Corp. was initially planning to raise funds in the bond market in January, but the natural gas firm decided to wait until its earnings were out at the end of the month—only to find that Russia’s invasion of Ukraine in late February had effectively closed the market for speculative-rated companies.

The Canonsburg, Pa.-based company, which is rated below investment grade, waited until August, and then again until September before it finally pulled the trigger, raising $500 million at 7.375% that will come due in 2031. CNX is using the proceeds to pay back $350 million in 2027 bonds that carry a slightly lower coupon of 7.25%.

“We timed it just about as well as it could be timed,” said Alan Shepard, the company’s chief financial officer.

Alan Shepard, chief financial officer of CNX Resources.

Photo: CNX Resources Corp.

“We’re constantly looking at refinancing to keep our maturities out as far as possible because the high-yield market is so fickle,” he added. “It can close down for long periods of time, so if you’re not careful, you get caught out.”

Executives at junk-rated companies are facing sharply higher financing costs as the Federal Reserve continues to raise rates, leading some to look for alternatives, while others like Mr. Shepard swallow the increase in price in return for later due dates. While there is limited pressure overall as many businesses refinanced in 2020 and 2021 when funding was cheaper and investor appetite stronger, high-yield companies with immediate financing needs have to find the right time to tap investors, corporate bankers say.

“This is a market of windows and our advice for clients is to be ready to access those windows when they present themselves,” said Alexandra Barth, co-head of the leveraged capital markets business at Deutsche Bank AG . “Even if the market is choppy, there are options.”

Those opportunities are crucial for finance chiefs as there is about $11 billion in high-yield bonds coming due through the end of the year, followed by roughly $62 billion in 2023 and $107 billion in 2024, according to Deutsche Bank. Adding loans and revolving-credit facilities, speculative companies have maturities of around $1.47 trillion through 2027, ratings firm Moody’s Investors Service said last week.

Companies with urgent cash demands still have options, including renegotiating with their lenders or alternatively searching for investors in the private credit market, which has grown sharply in recent years. Companies also can do follow-on or at the market offerings to sell equity to the secondary market, said Anna Pinedo, co-leader of the capital markets practice at Mayer Brown LLP, a law firm.

And the high-yield bond market isn’t closed, it has just become more expensive, bankers said. Companies raised $15.7 billion in speculative bonds in the third quarter, compared with $85.7 billion during the prior-year period, according to Refinitiv, a data provider. Average coupon rates for such deals climbed to 7.63% in the third quarter, up from 5.13% a year earlier, Refinitiv said.

The average yield on leveraged loans increased to 9.42% in the third quarter, when companies borrowed $125 billion, compared with a year ago when lower-rated businesses took out $296.8 billion in leveraged loans, with yields averaging 4.57%, Refinitiv said.

In addition to CNX, speculative-grade rated businesses including auto maker Ford Motor Co. and cruise operator Royal Caribbean Cruises Ltd. secured new funding in recent weeks, according to Refinitiv. Dearborn, Mich.-based Ford, for its part, borrowed $600 million from investors for 6.5% that will mature in 2062, and agreed to a $1.75 billion green bond which has a coupon rate of 6.1% and matures in 2032. The company declined to comment.

Royal Caribbean, based in Miami, recently raised $2 billion in funds to redeem debt that would have come due in 2023, agreeing to pay investors between 8.25% and 9.25% for notes that will mature in 2029. “We have access to capital,” Naftali Holtz,

the company’s CFO, said last month.

But financing options have tightened and the worsening economic outlook could hurt consumer-facing companies in particular, with a chunk of recent downgrades falling into that category, according to S&P Global Ratings.

“For a generation, we had a decline in interest rates and a decline in borrowing costs. That has led to higher and higher debt loads and lower credit ratings,” said Gregg Lemos-Stein, chief analytical officer for corporate ratings at S&P.

Low rates in recent years also brought with them weak covenant requirements, meaning that some borrowers didn’t have to take out hedges to protect their exposure to floating rates, for example, the Secured Overnight Financing Rate. That can spell trouble down the road as both the London interbank offered rate and term SOFR have traded higher in recent months and exceeded 3.4% for one-month tenors on Oct. 14, according to Refinitiv.

Anna Pinedo, co-leader of the capital markets practice at Mayer Brown.

Photo: Mayer Brown LLP

Still, default rates remain low and bankers and lawyers don’t see widespread distress. During the first three quarters of the year, 279 U.S. companies filed for bankruptcy protection, fewer than in prior-year periods going back to at least 2010, according to S&P Global Market Intelligence, an arm of the ratings firm.

Latam Airlines Group SA on Oct. 11 said it secured financing to exit bankruptcy. The largest airline in Latin America said its debt following the restructuring will stand at around $2.2 billion, roughly 35% less than what it carries now. Interests on its new debt, however, are at 13.375%, much higher than the ones on its existing debt ranging from 3.6% to 7%, according to the company’s filings. Latam also had to sell the notes at a discount to make them more attractive to investors.

Movie theater chain AMC Entertainment Holdings Inc. on Friday said that its subsidiary Odeon Finco PLC priced a $400 million bond. The bond carries a 12.75% coupon and was issued at a discount of 92 cents on the dollar for an all-in yield of roughly 15%, a hedge fund analyst said.

Bankers said they have received few calls from triple C-rated companies in recent months looking for maturity extensions. “It could happen in three to six months, but it is still early days and most companies accessed the market during the past couple of years when the backdrop was firm,” Deutsche Bank’s Ms. Barth said.

There could be some pickup in fundraising activity toward the end of the year, as companies want to avoid going-concern warnings in their annual financial statements, which can call into question their ability to stay afloat for another 12 months. “There could be a window for opportunistic issuers between now and then,” a banker said.

Meanwhile, businesses with credit ratings one or two notches above high-yield are also seeing their financing costs rise. Timken Co. , a manufacturer of bearings and power transmission products, in March raised $350 million with a 10-year bond at 4.125% to fund potential deal-making.

“We took advantage of the fact that rates were still low,” said Philip Fracassa, the company’s CFO. “If we went to the market today, we would probably pay closer to 6%.”

Timken’s next bond maturity will be in 2024.

Write to Nina Trentmann at Nina.Trentmann@wsj.com