What should we do if while giving alms our hands might accidentally touch the hands of a na-mehram despite taking precaution?

Nothing to worry about from the Islamic perspective since it isn’t intentional.