Generally, a drive with an installation of MacOS will work on any 'contemporary' hardware (i.e. hardware for which the OS is compatible). I have swapped bootable storage devices across a range of different Macs over the years with few problems, including 'transplanting' a drive from a 2009 MacBook into a 2012 MBP.
You should reset the NVRAM on first boot, to clear any settings that may relate to the old hardware. Instructions here
At worst, you may need to re-run the OS installer over the disk (from an external installer disk or from the Recovery Partition), which will update anything necessary while keeping your data preserved in place.
It's always good to have a USB to SATA cable, so that you can run the old drive as an bootable external, "just in case".
Obviously, the old Hard Drive won't work in the 2009 MBP (Mojave is too new for it, and the disk might be APFS) without repartitioning and a new installation of MacOS. I don't think that model has Firmware Recovery, so you'll need to do this on the old machine first.
NB: Always have a backup!