Hello,
Welcome to our Microsoft Q&A platform!
You can change the space by using Style. In the style of PivotHeaderItem, there is a Rectangle control which displays as the blue pipe, its default setting is VerticalAlignment="Bottom", you can try to remove it and change its margin to reduce the space between blue pipe and header text of pivot, like below. About the complete code of style, you can refer to this link.
< Rectangle x:Name="FocusPipe"
Fill="{ThemeResource PivotHeaderItemFocusPipeFill}"
Height="2"
Margin="0,25,0,0"
HorizontalAlignment="Stretch"
Visibility="Visible" />
Thanks.