I assume when you say when you type it lags within imessage? It's a keyboard bug but this trick fixes it. I had the same issues on my iphone 12 and it is now fixed.
1. Open the Settings app on your iPhone or iPad.
2. Tap on General.
3. Scroll all the way down to Reset.
4. Tap on Reset Keyboard Dictionary.
5. Provide your iPhone’s Passcode and the keyboard lag bug should be fixed.
Message me offline and I can work with you to troubleshoot your other issues.
I had an iPhone 7 previously and it was pretty reasonable until recently. Right from the beginning the iPhone 12 Pro Max has been slow and laggy. When I type it lags, webpages are slow, scrolling lags, the phone calls don’t connect properly for 1-3 seconds, various apps respond slowly to inputs. I couldn’t believe it. This phone, other than the new camera (which is only decent), is only very marginally better than my iPhone 7! What the hell?!!
Anyways, I bought an iPhone 8 Plus for $400 and am returning the 12 Pro Max. I can spend the $800 elsewhere that make an actual difference in my life.