Sometimes you just want to write part of an HTML code block to maybe wrap the next block in. Or some small part of HTML that may not make sense to the editor. It doesn’t matter though. The block editor will throw an error like “This block contains unexpected or invalid content”. Irritating.
One solution is to create a simple shortcode and return the html you want to write out. Shortcodes let you return whatever HTML you want and the block editor won’t know about it.