How to make a commandblock 1 time use for a player

You could tag a player with a chain command block after the first command block

Use this command to tag the nearest player within a distance of 5 blocks who doesn't already have a gotIt tag with gotIt.

/tag @p[distance=..5,tag=!gotIt] add gotIt

Use that tag with the /give command.

This command would give the item to the nearest player within a distance of 5 who does not have the gotIt tag:

/give @p[distance=..5,tag=!gotIt] <item>

Make sure that both commands execute at the same coordinates, you would have to use /execute with at least one of them.

/execute positioned <coordinates> give @p[distance=..5,tag=!gotIt] <item>
/execute positioned <coordinates> tag @p[distance=..5,tag=!gotIt] add gotIt

Make sure that you/give the item before you /tag that player