Hezbollah was firing rockets at Israel from Southern Libanon. Occupying the land until Hezbollah/Lebanon promises to stop shooting rockets at Israel is in principle legal under international law.
Russia’s invasion/annexation of Ukraine is entirely illegal and unjustified.
Those are not the same.