Inkscape has a built-in XML Editor, but you can't copy and paste the bare SVG code with it.
If you want direct access to the SVG code, you could simply keep the SVG file open in a text editor such as Notepad++.
Then when you update/overwrite the SVG by saving from Inkscape, just go back to Notepad++ and it will tell you that the file has been modified, and ask if you want to reload it. Click Yes. Then you can then copy and paste it from Notepatd++
Example showing an Optimised SVG saved directly from Inkscape, opened in Notepad++
If you don't necessarily need to save an Optimised SVG, but simply want the Inkscape SVG, then Ctrl+S will save the document with all the Inkscape-specific XML included.
There also used to be an Extension called Object-to-and-from-string. Not sure it will still work for recent versions of Inkscape 1.0 and later, since it's quite old. I haven't tested it.