No case is identical and thus it varies on a case to case basis, but ideally, you want to be with that person and communicate with them a lot, like, ask them if they want to hang out, that it is ok if you do nothing, just being together is fine in case they don’t wanna do anything (I remember that a friend who was going through some really harsh shit once asked me if I could just bring my computer and browse the net with him, he wanted to have company more than do anything), if they wanna talk, do anything like playing or watching a movie or do anything recreational, remind them to have something to eat, or in case it is their home itself that is being harmful, invite them over to your place for as much as you can afford to, there’s lots of things, but one must remember that these do not replace a therapy and, while you can definitely help someone through depression by other means than a therapy, there’s also a chance that you can’t.
Lots of little things are in play, but in general, not feeling alone is essential. Sayori’s specific case is exacerbated in purpose due to plot reasons, but if one hypothetically found a case like that, you’d want to alert authorities and a hospital, because someone in that deep a state of suicidal urges cannot be left alone and to their own devices for even a second.