You can place your cursor in your Google Doc and dictate using Voice In. However, as Google Docs uses an opaque document structure, Voice In cannot see where your cursor is on the page. As a result, it may get the text formatting, such as capitalization or word spacing, wrong. Also, commands like delete word won't work on Google Docs.
Note that this issue happens only on Google Docs / Slides. Voice In works perfectly well on other sites.
Here are three workarounds you can use for voice typing:
1. Use Dictation Box
To use all the features of Voice In, type your text into the dictation box. Enable the dictation box. Then, place the cursor in the dictation box and dictate normally. Once you are done, you can copy/cut the content into Google Docs. For more information, refer to:
You can use the Voice In Notepad at https://dictanote.co/voicein/notepad/ to type and format text. The Voice In notepad is a Word-like editor that supports all the basic formatting options. Once you have voice typed your note in the notepad, then copy paste it into Google Docs or any other site/external application.
3. Use the built-in voice typing tool
Use Google Docs' built-in voice typing tool. Go to Tools > Voice Typing to enable it. This feature is built into Google Docs. Note that you cannot use your custom voice commands with this tool.