The ICJ called for the arrest of Putin and Netanyahu. The US saw this and realised that it's now ok to arrest the leader of a sovereign country.
China is currently conducting military operations in Taiwan which is technically not a sovereign country. Taiwan exists as a defacto independent country based on the strategic ambiguity that that US might defend it if were attacked by China. According to international law that would be the US going to war with China over internal Chinese dispute. So technically speaking, defending democratic Taiwan from aggression from an authoritarian regime may be against international law.
Iran gives material support to terrorist groups like Hamas, Hezbollah, and the Houthis. These terrorist groups use weapons supplied by Iran to attack Israel (and in the case of the Houthis basically any country they feel like). Many people have been killed by Iranian weapons. Iran is most certainly engaged in a proxy war against Israel. This includes the genocidal massacre that occurred on October 7, 2023. Iran is complicit in genocide, but I guess that's ok according to international law.
You see, international law is more of a vibe than anything real. The UN is made up of people, many of whom are appointed by very corrupt countries and what is against international law is probably just decided cliques in the cafeteria in the UN HQ.
Like really, what is the basis that's used to determine which world leaders you think it's acceptable to arrest? Just your feelings on who you like and who you don't like? That's not how legal systems are supposed to work you know.
The only difference between the actions of the UN and the actions of the US is the US actually has the power to actually arrest world leaders and the UN does not.