Microsoft didn't make modern versions of the ScriptEditor or ContentEditor web parts because they felt that users injecting script directly into pages had too great a potential to destabilize the page or unintentionally cause data loss.
With all of that said, the SharePoint developer community felt that despite Microsoft's concerns there was value in having modern versions of the ScriptEditor or ContentEditor web parts so they created their own. Please see the following blog posts for more information.
Perhaps the only SharePoint Framework web part you will ever need (ScriptEditor)
Perhaps The Only OTHER SharePoint Framework Web Part You Will Ever Need (ContentEditor)