What type of key do you have. Yubikey 5 supports multiple protocols including some you can use with SSH:
- Multi-protocol: YubiKey 5 Series is the most versatile security key supporting multiple authentication protocols including FIDO2/WebAuthn (hardware bound passkey), FIDO U2F, Yubico OTP, OATH-TOTP, OATH-HOTP, Smart card (PIV) and OpenPGP.
SSH would need to implement webauthn to support FIDO.
Looks like this happened:
OpenSSH server has had built-in support for WebAuthn keys since 8.2.