verse 24:5 is about "women" in general, even unbelievers but 24:23 talks about "believing women". The punishment in case that the acuser doesn't provide 4 witnesses is 80 stripes and losing the credibility as a witness in the society, unless they repent and DO GOOD after that, to make it clear that they have repented honestly and sincerely. This punishment goes for both cases, but the one who acuses "believing women", is cursed forever too. in the later case, no extra "earthly" punishment is considered. Allah is the most forgiving! he may even forgive the people in the second category. This forgiveness is not contradictory to the fact that they are cursed forever. To make it clearer, suppose that you being "retaliated" by a person who suffers from a crime you committed against him. after, say cutting your hand off(!), he may forgive you, but the "curse" of losing hand is yours and with you forever, point is, being "cursed" doesn't mean being "unforgiven".