As usual, giving thought to this put it beyond two characters.
It's said one of the hallmarks of urban fantasy (this also obviously applies to contemporary horror) is that all characters are Fair Game. The potential death of any character, no matter how central to the narrative, ups the stakes and lets the reader/viewer know the characters are playing for keeps.
Joss Whedon, of course, isn't just an example of this, he's the King.
Joss sets the tone for his attitude towards character death in the very first episode of BtVS with the death of Jesse. It's well-known that Joss wanted to put Jesse in the main credits of Welcome to the Hellmouth just so he could stun the audience by killing him off. And behind-the-camera troubles aside, I'm pretty convinced that's (the writers' reason) for the death of Doyle in Season 1 of Angel. Both deaths were, IMO, non-gratuitous. Jesse's death occurred to instruct both viewers and the characters (in particular, Xander and Willow) that This Is Serious, Folks. Doyle, on the other hand, chose to die for a noble cause. It was no less shocking than Jesse's death, though, and you can imagine Joss' glee at finally being able to kill off a credits character.
Characters die for all sorts of reasons on BtVS and AtS, but one of the main reasons they die is to signal a change in the character who killed them. For Joss, this is usually a character we've come to trust, but sometimes, it's the rise of the bad guy (or both). Showing a character murder someone is Joss' signal that "something's changed." Examples abound: Jenny Calendar (Angel(us), Deputy mayor Allan Finch (Faith), Maggie Walsh (Adam), Katrina (The Trio), Warren (Willow), the wine cellar W&H lawyers (which Angel allows through inaction), Lilah (Beast-Master!Cordelia). The problem isn't that Joss does this. The problem is, he does this A LOT.
There are lots of other ways you can signal a change in a character and a change in the direction of a season. Wesley's betrayal of Angel in Season 3 was an effective way to change the stakes mid-season and resulted in interesting developments for both characters, without anyone having to die during the act of betrayal.
Joss' over-reliance on this trope lead to a lot of "the devil made me do it" story lines in which trusted friends (e.g., Angel, Cordelia, Spike [season 7 *oy*] must be robbed of their agency in order to make them kill somebody.
The other thing Joss overdid was Beloved Character Has to Die to Enact Change in the Hero or Season. Now, this can be an extremely powerful plot development. The first episode Joss did this in, Passion (Jenny Calendar's death), remains one of my favorites.
But there is a tipping point in keeping the stakes high where you start to lose a viewer or reader's investment, where it becomes so common for characters to die, viewers are no longer willing to invest emotionally in the characters. When a viewer reaches this point, they can either take a more flippant attitude towards the show, or stop watching it all together. I doubt either of these outcomes is something show-runners want.
I think the tipping point for me was Tara in Season 6 of BtVS. I could deal with Joyce dying in Season 5 to mark the transition of Buffy into adulthood. But Tara's death taxed me. Follow up that up with Cordelia's slow fade in AtS, and Fred's gratuitous assault in Season 5 of AtS, and I pretty much held my "giving a shit"-edness together only by sheer force of will to the end of AtS season 5. My issue with each of these deaths went beyond "too much is too much." They were also each out-and-out slaughters. None of these characters had a chance against their killers (Cordelia was effectively killed by Jasmine in Inside Out, despite her coma and brief return in Season 5). They were ruthlessly slaughtered by a Baddie just to shake things up.
For me, when it comes to major characters, the best deaths (1) show a victim dying against their killer after a valiant defense and because no other, alternative plot developments can effectively accomplish what their death can in the story (hence why Jenny Calendar's death works better than Tara's or Fred's); or (2) someone (directly or indirectly) causing their own death because their actions, or deliberate inaction, either heroic or villainous, resulted in it. When this happens to a villain, it's poetic justice. When it happens to a hero, you get Doyle, or Buffy (but she always comes back), or Darla in Lullaby (although there is a Madonna/Whore element to her death that annoys me a little).