Recall that a Visit comprises of one or more Hits.
So, your Visit-based segment will search for any Hit in a Visit that matches your Tracking Code conditions. Whereas a Hit-based segment will search for specific Hits that match your Tracking Code conditions.
Think of segmentation as trying to get a box full of data from Adobe Analytics.
First all of your data in Adobe Analytics are contained inside an initial big box. If you open this box you will see multiple Visitor boxes. Each of this box will contain all of the data about a specific visitor. Now if you open any of the visitor box, you will see multiple visit boxes. Each of the visit box will contain all of the data for a specific visit. now if you open a visit box you will see multiple hit boxes. Each hit box correspond to one adobe analytics server call and all of the data in this server call.
So for the first segment what it would do is go to the level of the visit boxes, open each one and just check if either tracking code A or tracking code B are present in this box. It does not matter if they are in different sub-hit boxes, if any of them are found the full visit box worth of data will be taken for your final data set.
For the second segment what it would do is go to the level of the visit boxes, open each one and in this case it would move to hit box, open each one and evaluate if tracking A or tracking code B exist in this box. If it does it would take the initial visit box that contain this hit box. So in this scenario we check at hit level, either one of the tracking code need to be present in the hit box only.
In your case it does matter much but if instead of using OR between the tracking code rules you use AND, the data that will be returned will be completed different. In first segment you will have data as in a visit box, it is possible that 2 hits have tracking code A and tracking code B. However in second segment, it will not return data as in a hit box it is not possible to have tracking code A and tracking code B