To answer to the developer, as other people mentioned as well the lag spikes occur randomly while performing several actions; during my attempts to resolve the issue by playing with the settings, I've had it happen while moving around, while performing actions, while in the inventory screen and while fighting mobs. It doesn't seem to be related to any specific action, graphical setting or other things (weather conditions do not affect the freezing either)
After updating to 1.20.31, the issue is still persisting
Answering to KostasGATE21, I just made a fresh survival world in 1.20.31 and the freeze happened twice in the span of one minute and thirty seconds