Sure, you might get a loading error if you try to run your Ubuntu 24.04-compiled executable on Ubuntu 18.04 if you use the default toolchain. tTat’s exactly the same as C or C++, only much easier to fix in rust by rustup-installing the right tool chain.
Compiling on Ubuntu 18.04 and running on 24.04 is absolutely not an issue. Same for windows.
In practice this is really not a problem, especially for cargo libraries that you anyway build from source.