Depending on the city/hostel, they might not allow a city resident to stay in their hostel. Aside from that, in dealing with a difficult situation like the parent comment mentions I don’t think many people would enjoy being in a many-person bunk room with zero privacy.
Anecdotally, I’ve had to stay in a hostel due to relationship issues and it was awful, more expensive than an airbnb, but was the only thing I could find last minute.