Phonon effects on the dynamics and fidelity of two-qubit gates using trapped Rydberg ions