Depends on what the damages are. If your hull integrity is low enough so that you're going to have trouble getting under 100 m, I'd head home. Deck gun, aft torpedo tube damages....meh, doesn't matter much. Periscope damages are a definate RTB.
IRL Peter Cremer of U-333 stayed on patrol in the Caribbean after being rammed by the SS British Prestige causing this damage: