Bodmer has an excellent TFT_eSPI library that you can install via the IDE Library Manager.
There are ready-made Setup files for RPI displays.
Or you configure a custom Setup for yourself.
Yes, you will have to swap / edit Setup between RPI and ILI9341
but this saves editing every sketch file.
David.