Fix lagging trackpad by resetting bluetooth
To fix a lagging external trackpad trackpad in my case the original Apple trackpad and and M2 Air. This can be done by resetting bluetooth. In your terminal:
sudo pkill bluetoothd
Enter your password
Wait a few moments while hardware reconnects and your problem should be resolved