There's a new "create a pass" feature in Apple Wallet for iOS 27, and I just used it to add library cards, with barcodes.
Here are the instructions from Apple's website for how to create a pass in Wallet.
support.apple.com/guide/iphon...
The "standard" template works well for library cards.
support.apple.com
Create passes in Wallet on iPhone
In the Wallet app on iPhone, make your own passes from a physical card, photo, or screenshot.