Quite a few things could cause lag… and combinations of them could compound lag issues.
The operating system being outdated can cause the software to run less optimally.
Processor speed, the more complex the software gets the more the processor has to do to keep up.
The amount of RAM available. The more information (program, data, etc.) that can be accessed from RAM the faster the program will run. If there is only a limited amount of RAM the program will only load what is absolutely needed. If a routine is selected that is not currently in RAM and there’s a lack of space to run it then something will need to be moved out of RAM (usually to internal storage or cache if it’s available). If internal storage isn’t available then it may just be removed and accessed and rebuilt from the program files when it is needed again.
The amount of remaining internal storage space. Cache may need to be cleared.
The phone or the processor heating up. As the processor heats up it begins to run slower.
Multiple apps being loaded and apps running in the background. The additional apps take up RAM and also add to the load on the processor.
Software issues could be caused by memory leaks but usually those problems aren’t noticed until the software has been running a while. As the amount of RAM is decreased, the software has less space to run which may increase more information being swapped in and out of internal storage. Restarting the app would return any memory it had leaked, but wouldn’t return memory that other apps that are still running may have leaked. Restarting the phone shutting down all apps should restore all leaked memory.
Most of the time I have no problem running the game on my phone (iPhone X). But the one area I do have problems with is if my phone starts to get hot, I begin to see lag issues. And the hotter the phone gets the worse the lag issues get.