Bluetooth 5.0 is the latest version of Bluetooth, and it has some improvements in terms of range, speed and sound quality.
On the other hand, Bluetooth 4.0 has almost similar specifications and is also backward compatible with all versions of Bluetooth 4.0 or below. That means it will work on Bluetooth 3.0, 2.1 etc., devices also, but you have to keep in mind the connection range will be affected as these versions are older and slower.