Short-term memory temporarily holds data for immediate use, while the function of long-term memory is to create permanent knowledge for future retrieval.