Maximize iPhone battery lifespan by keeping it plugged into power whenever possible I know, sometimes it can explode, but is it a good advice to let the iPhone - whenever possible - plugged in to a power outlet in order to maximize battery lifespan (so it's almost always at 100%)?

If it matters, it is an iPhone Xs.

Also, I know, from time to time (few times in a month at least) every battery should be used until it's empty and then fully recharged, that's clear to me.
Yes - keep your iPhone XS and newer plugged in unless you put it in long term storage. Then 50% charge and power it off.
There is no reason to not fully charge and keep attached the latest iPhone and iPad devices that run iOS 11.3 since there are now charge management enhancements to avoid voltage pressure and lack of discharge that can cause issue on older devices and operating systems.

https://support.apple.com/en-us/HT208710


iOS includes a charge management feature to maintain battery health when iPad or iPhone XS, iPhone XS Max, or iPhone XR is connected to power for prolonged periods of time, such as when used in a kiosk or a point of sales system, or stored in a charge cart.

Your XS is better off to leave plugged in since that reduces charge cycles. Unless you aren't going to use if for a couple months, then discharge or charge to 50% and shut it off:

https://www.apple.com/batteries/maximizing-performance/


Older devices and older operating systems do require you to balance the need to have it charged with the need to delay eventual failure. Every single lithium battery will eventually swell and/or disconnect itself electrically if it doesn't fail some other manner prematurely.

https://support.apple.com/en-us/HT208387 - information on chemical aging of batteries

iPad being using in wall mount battery swollen