How do I end a section in Writer when I'm numbering lines?

I think those gray rectangles that go around a part of your text are called sections, right? When I’m inside one and I press Enter, it expands the section. How do I end it? Someone told me to press Alt + Enter but that only stops the numbering. Then it resumes numbering, but inside the section. If I press twice, it does leave the section, but I haven’t found a way to continue the numbering after that.

Try the arrow keys to leave the section.

If the cursor is in the last line of a section, Alt+Enter creates a new line below this section.

Do you ask about menu Tools - Line Numbering… or about menu Format - Bullets and Numbering…?

See LibreOffice Help on Adding Line Numbers and on Numbering and Paragraph Styles

There’s no line under the section for me to go to. I need to create a new line outside the section and continue numbering my lines there, but Alt + Enter stops the numbering and only then takes me outside the section.

There seems to be a vocabulary/description problem here. Please provide a screenshot so that we can figure out what you “gray rectangles” effectively are. And to be complete, mention your OS name and LO version.