I think it depends on the breakup and emotional boundaries. If we both genuinely moved on and respect each other, staying friends can work. But right after breaking up, space is usually healthier.
Not immediately after the breakup that you should think of being friends with your ex. It would be very difficult for you guys to move on. You can just give it some time like two months so that everyone can move on. Then you guys get to being friends.