A proton can exchange charge with the neutron via a process called "pion exchange". In this process, the proton with quark content $uud$ sends a positive pion $u\bar{d}$ over to the neutron $udd$. The antidown annihilates one down quark in the neutron and adds an up quark, turning the neutron into $uud$, a proton. But what happened to the proton? By sending one of its up quarks and creating a down-antidown pair, it's left with $udd$; it's now a neutron.
So even though they swap charge, you're always left with a proton and a neutron at the end of the exchange.