Ancestry use their own software algorithm called Timber which aims to strip out segments of DNA that they believe are not actually evidence of a close genetic relationship, but instead consist of areas of DNA more commonly found to be identical across multiple people whose ancestors originate from a specific region.
The overall match length that Ancestry quote is the length calculated after Timber has removed any such regions. But they also show the "unweighted" match length, which is the length of the match before the Timber algorithm had been applied, and the longest segment is also based on the unweighted match.
So in the example you have given, you have a 41 cM match with Ann. The match is across a single segment, because the longest segment length is the same as the overall unweighted length.
But Timber believes that 18 cM of that match is more likely to be derived from a general population similarity, rather than a close genetic match, so it has removed that portion of the match and left you with a shared match of 23 cM, still of course within that single segment.
Most other test providers don't carry out any manipulation of the overall match length, so Ancestry's unweighted match length is often more likely to approximate the match lengths reported for the same individuals by other companies.
But it can be useful when comparing matches between closely related people on Ancestry.