The general approach for this would be to have a transaction filter that detects pastes (tr.isUserEvent("input.paste")) and adds changes that reindent the affected regions (see indentRange in @codemirror/language 6.2.0) for them.
There is another use case where I am inserting the text in and that text needs to be indented. For the I will get the changeSet from indentRange. I am confused on how to use this changeSet, do I have to dispatch it?