The time evolution of a single Cooper pair in the presence of another Cooper pair interacting with an electromagnetic field in a dissipative cavity is presented. The strong dependence of the dynamics of two superconducting charge qubits interacting with the microcavity field on the instantaneous phase shift experienced by the second qubit is demonstrated. The Pancharatnam phase is found to be more sensitive than the population dynamics to the phase shift. This leads us to suggest a new technique for controlling the system dynamics. Furthermore, although the atom is not directly coupled to the cavity modes, its coherent properties are found to be strongly influenced by dissipation, both qualitatively and quantitatively.