There are two options. Create a backup of your current installation from OctoPrint's settings, and download that file, flash the latest octopi 0.18 version and then complete the initial setup wizard (you won't be able to complete the restore because of older version). Upgrade that install and then restore the backup.
The other option is to just run the upgrade script on your current pi.
Depending on the OctoPi version and what you have installed, it should just work. However, if you have installed anything beyond standard OctoPi software that compiled itself for the specific Pi then you will have issues.
if you do a sudo apt update and sudo apt full-upgrade -y on the pi 3, it will have all the files needed for the pi4. you can then do sudo shutdown -h now and power off the pi3 and insert the card into the pi4 and power it on.