We do it quite often. I've had no problems with it yet.
Generally a trip is assigned originally to 1 Capt and 1 FO, and that Capt retains the PIC responsibilities if another Capt is assigned to replace the FO. If the trip involves several segments, we will usually agree to swap PIC responsibilities on the segments.
In the case where 2 Capts are assigned to an ad hoc trip, the senior one will be PIC unless they agree to switch. The same swap routine as above applies.