For anyone having difficulties with the scp command using yubikey, here is the proper syntax I used to copy a file from a local machine to a remote server:
scp -i ~/.ssh/id_rsa_yubikey.pub -P 22 local_file_to_be_transferred.txt remote_username@local_server_ip_address:/remote/directory_of_server
where -i = your yubikey identities file, -P = your ssh port, remote_username = your username that you use to log in to your server
In my case:
scp -i ~/.ssh/id_rsa_yubikey.pub -P 40001 /Users/Danrancan/Downloads/myfile.zip firstname.lastname@example.org:/home/Danrancan
This should successfully securely copy your file from your local machine to your remote machine or server.