For me 2000 yards is max range desperation shot when I can't get closer. 500-1000 yards is ideal range. Exception is when shooting multiple ships in a convoy, for that I might go as high as 3000 yards at big slow moving freighters, starting with the farthest first, allowing 20 seconds per 500 yards at each closer target - the idea being to make all the hits within a few seconds of each other so they don't have time to react. Perfect setup is when I have the closest ship at 500 yards with a 90 degree track, furthest at 2500-3000 yards, firing across the track of the convoy. Depending on how big the convoy is and if the lead escort is out of position I might center the sub dead ahead and fire alternately from the bow and stern tubes, accepting a large gyro angle (up to 45 degrees) in trade for hitting multiple targets with a single attack.
Shooting at maneuverable warships of course is a different animal, for that I'd rather be lucky than good. Even so closer is better, higher percentage of hits when they have less time to dodge.