Wasalam bro, are you looking to learn more about a specific situation? Or are you just trying to explore the topic at a broad level?
I'm guessing you're hinting at someone sacrificing their life to save others, which isn't technically the same as suicide. Even if it leads to the same outcome to the person dying, the intention is different in both cases, and as we know from the famous hadith, actions are judged by intentions.
Ultimately if you're looking for a specific answer for a specific case, you should reach out to a local Muslim scholar you trust, but I hope I gave you a little more clarity on how to approach your understanding of the topic.