You need to get one that is designed to be a navigation bulb for sailboats. It is right next to the VHF antenna, and a generic bulb will interfere with VHF, and could completely wipe out AIS. The USCG issued a memo/warning about it.
Also, there is a color temperature difference. Although they "look" white to the naked eye, when behind a green or red lens LED can change color, resulting in a pink or blue color instead of red or green. An LED for a tricolor is different than an LED for an Anchor light, even if the base is the same. In some cases the LEDs are indexed, with a different temperature port and starboard, so they become specific to the fixture in how the bulb is oriented behind the LENS.
I don't think the navigation lights are standardized across all years/versions. Mine is an aqua signal combo tricolor/anchor light, and I bought bulbs from Dr. LED that are USCG certified for an Aqua signal fixture. Expensive, but I have had no issues. I installed with a bit of dielectric grease to prevent corrosion, and they have been reliable for several years and 30,000 ocean miles. The aqua signal uses the 1157 type bulb.
Nitpicking, but worth knowing. A "masthead" light is defined as the forward facing light that is on while you are motoring, despite it not being on the masthead. On a motor vessel, it IS on the masthead, and while motoring a sailboat no lights may be on above it, so from a distance it looks like the masthead. On the top of the mast you may have, a tricolor, an anchor light, or all around red over green- but none of those are masthead lights.