If you wish to add text to a post or page that is displayed exactly as you type it, the preformatted block is for you.
Get started by clicking the + Inserter icon at the bottom-left corner of the screen and select the Preformatted Block from the blocks list
The preformatted block shares a lot of similarities with the paragraph block and the code block. Think of it as a hybrid of the two.
Like the paragraph block, the preformatted block is intended primarily to display text. Unlike the paragraph block, though, the preformatted block keeps any spacing or line breaks exactly as they are entered.
Similar to the code block, the preformatted block is displayed in a monospace font, making it easy to keep text perfectly aligned. However, the preformatted block also includes styling and the ability to add hyperlinks that a code block doesn’t have.
And as you can see, the published version keeps the spacing