One of the most popular ways to change how apps perceive your IMEI is via an Xposed module. Since Xposed is now typically run through LSPosed on Magisk, this is a clean, modular approach. Install the LSPosed module in Magisk.
Most IMEI-changing modules require the LSPosed environment to hook into system calls. Step 1: Install the LSPosed Framework change imei with magisk