Global trade is under threat again. This time from missile attacks linked to the Israel-Hamas war targeting commercial ships passing through the Red Sea, near the Suez Canal. That may force many vessels to take the longer but safer route around Africa and is boosting oil prices.

For shipping owners, the development both gives and takes away: Clients will be forced to pay up for higher rates, but shippers will also have to absorb higher fuel costs. Tanker and liquid petroleum gas shippers look best placed since capacity utilization is tight and trouble at another major canal—the one in Panama—has already given them a huge boost in bargaining power.

Brent oil prices rose around 1% on Tuesday, according to Refinitiv data. Shares of A.P. Moller-Maersk, a top global container shipper, were down over 3%. Shares of Dorian LPG, a major LPG shipper, were up nearly 2%.

Oil giant BP on Monday became the latest company to halt its tankers from sailing through the Red Sea. Many of the world’s biggest shipping lines, including Maersk, Hapag-Lloyd and MSC have started diverting vessels from the region. These new attacks are compounding disruptions to global trade already suffering from a historic drought in the Panama Canal.

Jefferies estimates container fleet utilization could surge from 77% to 88% and oil product tanker capacity could become entirely booked up—it is already high at a 95% utilization rate. A containership traveling from the Far East to Europe takes 21 days via the Suez Canal but 42 days if going around Africa, according to the bank. A tanker from the Middle East takes 17 days to get to Europe using the Suez Canal but 41 days if going around Africa.

According to Jørgen Lian, an analyst at DNB Markets, rates have already been inching up: War risk premiums have increased for voyages in the region and vessel owners may be holding out for more optionality on routes.

The intensity of the impact will ultimately depend on how much volume is redirected in the coming weeks. The U.S. unveiled a multinational naval force to protect merchant vessels in the Red Sea on Monday, which could reduce the risk of attacks. Egypt also has a significant commercial interest in the functioning of the Suez Canal as it is an important revenue source for the government.

Container shipping is in a less favorable position than tanker owners since global container trade has been weak. Maersk, which handles about a fifth of the world’s container shipping, redirected its ships around Africa in 2021 when the Suez Canal was blocked for several days. At that time, during the pandemic era trade boom, rates got a real boost. But 2023 couldn’t be more different. In August, Maersk predicted that global container trade would contract as much as 4% this year. Even after a significant recovery since mid-fall, its shares are still down about 17% since July.

Tankers, in contrast, have a very strong hand. The Russia-Ukraine war has already boosted tanker utilization due to lengthening trade routes from the Black Sea and Baltic Sea. Strong U.S. exports of LPG and low water levels in the Panama Canal are another source of leverage for some firms.

Repeated disruptions to key trading routes are bad news for global trade and consumers. Petroleum product and LPG tanker firms may be salivating. But container firms are in a trickier position—particularly if oil prices keep marching higher too.

Write to Megha Mandavia at megha.mandavia@wsj.com