To actually answer your specific questions:
How do I connect a sub-panel with neutral and ground to the same bus bar in main panel?
In the main panel it doesn't matter on which us bar you land the feeder's neutral and ground, but make sure the lugs you choose are rated for the gauge and type of conductor, and if using aluminum, you should use Noalox and the proper torque.
When I connect the sub-panel to the main panel, does it matter which bus bar I connect the ground and neutral?
No, It doesn't matter in the main panel.
Yes, it matters in the sub panel. First, REMOVE the bonding strap that connects the two bus bars in the sub-panel. Then in the sub, it should be visually obvious that one of the bus bars is insulated from the case. If not, use a volt meter to find out. The insulated one is for neutral. The one that conducts to the case is ground.
Do I need to separate all of the other ground and neutral wires on the bus bar when I connect the sub panel?
Yes. In the sub-panel grounds and neutrals must be only on their corresponding bus bars.