Marco Reus scored twice for Dortmund in Germany, but Madrid still advanced into the semi-finals following an aggregate score of 3-2.
"We have suffered a lot and we knew it was a difficult game," Carvajal told reporters.
"Their two goals came from our mistakes. Suffering and coming through it is good to learn from. We're in the semi-finals but we've suffered.
"[Going through] gives us encouragement. Next is Almeria and then we will prepare for the Cup final."
The draw for the semi-finals of the Champions League takes place on Friday.