The purpose of hook_file_download is to Control access to private file downloads and specify HTTP headers. The hook_file_download_access is restrict the access to certain files based on the entity type. e.g.,
only users with access to a node should be allowed to download files attached to that node.