We study the evolution of two planets around a star, in mean-motion resonance and undergoing tidal effects. We derive an integrable analytical model of mean-motion resonances of any order which reproduce the main features of the resonant dynamics. Using this simplified model, we obtain a criterion showing that, depending on the balance of the tidal dissipation in both planets, their final period ratio may stay at the resonant value, increase above, or decrease below the resonant value. Applying this criterion to the two inner planets orbiting GJ 163, we deduce that the current period ratio (2.97) could be the outcome of dissipation in the 3:1 MMR provided that the innermost planet is gaseous (slow dissipation) while the second one is rocky (faster dissipation). We perform N-body simulations with tidal dissipation to confirm the results of our analytical model. We also apply our criterion on GJ 581b, c (5:2 MMR) and reproduce the current period ratio (2.4) if the inner planet is gaseous and the outer is rocky (as in the case of GJ 163). Finally, we apply our model to the Kepler mission's statistics. We show that the excess of planets pairs close to first-order MMRs but in external circulation, i.e., with period ratios P out /P in > (p + 1)/p for the resonance (p + 1):p, can be reproduced by tidal dissipation in the inner planet. There is no need for any other dissipative mechanism, provided that these systems left the resonance with non-negligible eccentricities.