Losses in wire with varying cross section along its length
IR losses in the cable are proportional to each conductor segment.

Yes - your last few cm of cable does have higher resistance than the other cable segment.  You can calculate the loss for each cable segment, then add those losses together to come up with the total loss.

Also be aware that you may need to be concerned with the cable insulation in the smaller-diameter segment.  If the current is sufficiently high, the conductor will get hot.  The insulation on the conductor must be rated for the temperature that the conductor is operating at.

If the current is too high, the temperature of the smaller-diameter segment will rise to the point where the conductor burns open.  You want to ensure that the current is well below that point.

In general, the approach that you are taking is appropriate.  Keep the conductor diameter as large as possible right up to the point where it has to get small.  The overall loss is minimized when you do this.