Your screenshot doesn't show the home indicator. Your text and button is too close to the corner of the screen.
Inset essential content to prevent clipping. In general, content should be centered and symmetrically inset so it looks great in any orientation, isn’t clipped by rounded corners, isn’t hidden by a sensor housing, and isn’t obscured by the indicator for accessing the Home screen.
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/, emphasis mine
I understand not wanting to have a ‘strange gap’, but really that gap is not strange at all and required for suitable use of the home indicator and obeying safe areas.
Use matching insets when placing controls at the top and bottom of the screen, and leave ample space around the Home indicator so people don’t accidentally target it
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/
Your content should be present in the blue area indicated below, with only backgrounds extending to the bottom of the display.

https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/adaptivity-and-layout/
This is standard practice for tab bars and toolbars — your bottom content should stop above the home indicator, and only its background material can extend beyond the safe area.

https://developer.apple.com/design/human-interface-guidelines/ios/bars/toolbars/
Therefore the end result should look something like this, with a distinct unclipped area for tapping the close button.
