With iOS 17, NameDrop is automatically turned on. But you should still check the settings to confirm that it's enabled and to adjust certain options. Go to Settings, select General, and then tap AirDrop. Make sure the switch is turned on for Bringing Devices Together.
At this screen, tap the option for Everyone for 10 Minutes if the other person is not in your contact list. Otherwise, leave the option set to Contacts Only. And if you want to try the feature over a cellular connection, be sure the switch is on for Use Cellular Data.