And that is what those environment variables can allow you to do. For example, I have a version of python built via MacPorts which is staged in /opt/local/. Normally, it will search for Frameworks and dylibs in /opt/local/Library/Frameworks/ and /opt/local/lib to bind at runtime.
Setting the environment variable DYLD_PRINT_LIBRARIES causes dyld to print a dump of all the frameworks and libraries bound at runtime to verify what is actually being loaded from where. Normally, my MacPorts python would load ncurses from /opt/local/lib/libncurses.5.dylib. If I setenv DYLD_LIBRARY_PATH /usr/lib/ and execute my MacPorts python again, it loads ncurses from /usr/lib/libncurses.5.4.dylib.
See the manpage for dyld for more environment variables that you can use to manipulate how dylibs and frameworks are loaded at runtime.