Problem 1: tab stop at right margin
In Writer, all tab stops are relative to left indent (specific left “margin” of paragraph). There is no alternate origin like right edge. Therefore when you change your margins, you must recalculate your stop position, mostly when you want to align with the right margin.
Fix: define a new stop slightly lower than 18cm and delete the one at 17 cm in Header & Footer paragraph style. The fix will be forwarded automatically to Header and Footer paragraph styles.
Problem 2: header
Your right header part is a wide string, larger than the distance between the center tab and the right tab. It is preceded by two Tab characters. The first Tab sends the cursor to the center. The second tab initially sends the cursor to the right edge and the string fills the available space, extending left. When contents reaches the center position, no more room is available on the line (because the first tab created a boundary) and new words are sent on next line.
Fix: if you have no use for the center position (no data to set there), remove the center tab in Header paragraph style and suppress one of the Tab character in the header
Problem 3: footer
Footer paragraph style has the same problem regarding stop position. If you modified Header & Footer, this issue is already fixed.
But, you applied a center alignment request as direct formatting in your footer. and this messed up aligned in all three parts of the footer.
Fix: select the whole footer and Ctrl+M to clear direct formatted. You have only one Tab character, perhaps in an earlier attempt to fix things. Make sure this is the case everywhere.