Number one worst reason to kill off a character in media:
They've completed their character arc/fulfilled their narrative purpose.
Second worse character to kill off a character in media:
To make a point/shock value.
Reason these are bad reasons to do so:
To begin with? It's extremely easy to make both ring extremely hollow, especially on the rewatch, and runs a high risk of feeling cheap. There's also the fact that, if you do this once it can feel jarring and out of place, but if you keep doing it then it risks numbing the readers/viewers to other characters and the overall story. After all, why get invested in a character who could die out of nowhere for no reason and with no narrative satisfaction?
Also, once a character is dead? That's it, no more, their story is generally over, meaning you have one less potential tool in your box for telling the remaining story, and it's always good to have a few cards up your sleeve for later use. Every character and setting is an opportunity, something that you've worked hard to create and get the viewers/readers invested in. Kill or destroy them, and that's the last bit of use to be had from that investment, and often a new character or setting will be needed to replace the one that's gone now, and that the viewer/reader will need to get invested in, and that will get harder to achieve each time it's done.
I'm not saying that no one should ever die in any story ever - that would obviously be bad writing advice. More, if a main/prominent character dies, then it should have weight. It should open new ways to view the characters who knew the one who died, how they interact with the world, possibly even the world itself if they were important enough in their setting. A nameless mook can be tossed aside with little thought, a character who's known fairly well but isn't a main protagonist or antagonist is generally quite good to use if you absolutely need to make a point or have an abrupt tone shift (though it should still be handled with care), but a main protagonist or antagonist, who's been around for an extended period? Unless there's been one heck of a build-up and/or has an extensive narrative pay-off? Leave that sucker alive. Put them in jail, send them off on a solo quest, stick 'em in a coma, heck, create a situation that's vague about whether or not they survived, you don't have to keep them in the story, just keep them in the setting.
And yes, of course there are the exceptions to this, where character death is frequent and anyone being vulnerable to it is the norm, but it's not something that can be supported by most stories or genres.