For some reason when I am in creative mode, I lag so badly, but when I switch to spectator mode, my game is completely okay. But the thing is what is causing the lag in creative mode? I checked the debug profiler and the tick percentage rules over everything and I pressed "1" on the keyboard and it says something unspecified is lagging the game. Also, turning every setting to increase fps doesn't help and it is exactly the same as having my regular settings. Any clues what this is?
The lag disappearing when you switch to spectator mode could possibly suggest that your random tick speed is set to an extremely high number, causing lag. Random ticks usually occur around the player, but not around players in spectator mode.
Try to set the random tick speed to 3 (the default value).
/gamerule randomTickSpeed 3