Dephasing due to electromagnetic interactions in spatial qubits