Rooming with friends is a very delicate matter. It is one thing to hang out, spend time etc work with a person for short periods of time. Sharing a living space is a completely different ball game.
When you share living space there are so many factors that affect the relationship. How clean and organized a person is or not. How late do they stay up, how early do they wake. Are they noisy, are they quiet. Are they reserved, or do they like having company over. How long do they occupy bathrooms and showers. So many other factors.
Chances are that if you are a neat freak a disorganized roomie could drive you up the wall, if you like curling up with a book to relax and your roomie likes to play video games and watch Tv aloud 24/7 then there will be a lot of conflicts. You would be better of sharing a room with someone you do not know that well but has a similar lifestyle and thought process as yours.
Other trivial things matter. I have seen once best friends argue about silliest things. One person may think that they are close enough friends to eat the other person food or share clothes, but there is a delicate line and some people end up crossing the lines of personal space. There are also arguments like cable bills where one person will argue that they never wanted cable so they wont pay for it and then another will say oh well then don't play X-Box, its mine and stuff like that. No matter how close you are as friends, it is always in best interest to write down how bills will be shared and set ground rules on privacy, food, clothes, sharing stuff etc.
However, sometimes people just click. Two friends may have a lot in common that rooming together feels natural. The relationship is almost family like, leading to minimum conflicts. When people are open minded even starkly opposite people manage to room together, tolerate differences and adapt from each other.
Then also sometimes roommates can end up being a lot more than friends. 😉 When that happens it is a whole new ball game and a whole set of issues to consider.
Bottom line rooming with friends is possible. Distance is ideal but not necessary. Just make sure you give it a lot of though, assess your personalities and are mature about the situation.