trailingslashit() function adds a
/ to the end of a URL if it lacks one.
user_trailingslashit() uses the permalink template as set under Settings > Permalinks to decide whether to add or remove the trailing slash from the end of the URL
For example, if you had the permalink format set to
/%year%/%monthnum%/%day%/%postname%/ (note the trailing slash),
user_trailingslashit() would append a trailing slash to the URL passed in as the first parameter.
If the permalink format was
/%year%/%monthnum%/%day%/%postname% (no trailing slash), any trailing slash on the URL would be stripped off.
user_trailingslashit() forces the URL to be consistent with what is set in the permalink preferences.