It's probably something in the environment of your shell. From the manual page for su:
-l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as
above. USER is set to the target login. PATH is set to ``/bin:/usr/bin''. TERM is imported from your current environment. The
invoked shell is the target login's, and su will change directory to the target login's home directory.
- (no letter) The same as -l.
Running su -
throws out the contents of your environment and sudo does not. Rather it's keeping something around that's throwing off something about whatever the ldconfig command was trying to do.