Where did you create a form? Did you create a SharePoint list to store the form submissions?
In SharePoint, when user creates a list item, user ID is stored automatically in Created By column:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.