If your Magic Mouse and Magic Keyboard started lagging after updating your iMac from Ventura to macOS Sequoia 15.7.8, the issue is likely related to Bluetooth software, pairing, or interference rather than the devices themselves.
Since the keyboard works normally when connected by Lightning cable, the Bluetooth connection is the likely problem.
A - First, turn Bluetooth off and back on, then restart your iMac. If the delay continues, remove both devices from System Settings >> Bluetooth and pair them again.
B - You can connect the keyboard with the Lightning cable while re-pairing.
C - You can also try resetting Bluetooth settings by opening Terminal and running:
sudo rm /Library/Preferences/com.apple.Bluetooth.plist
D - Restart your Mac afterward and reconnect your devices.
E - If the problem remains, disconnect USB accessories, hubs, and external drives temporarily, as they can sometimes interfere with Bluetooth.
F - Also try moving the iMac closer to the mouse and keyboard and switching your Wi-Fi network from 2.4 GHz to 5 GHz if available.
Resolve Wi-Fi and Bluetooth issues caused by wireless interference
If your iMac is Intel-based, resetting NVRAM may help. Apple’s instructions are here: Reset NVRAM on your Mac
If the issue continues, check whether the delay occurs in a new macOS user account. If Bluetooth works normally there, the problem is likely related to your user settings rather than the system.