Router OS versions are numbered sequentially, when a period is used to separate sequences, it does not represent a decimal point, and the sequences do not have positional significance.
When upgrading Router OS, you can choose a release chain from which to install the new packages.
For mission critical installations, bugfixes-only release chain is suggested, as it does not include freshly added new features and is kept for a long time on the download page, with only critical fixes applied to it.
Choose your system type, and download the upgrade package: Connect to your router with Winbox, Select the downloaded file with your mouse, and drag it to the Files menu.
Therefore v5.2 is older than v5.18, which is newer.
When using a Router BOARD device, it is always suggested to upgrade it's Router BOOT bootloader after Router OS is upgraded.