If you have the ID of the user you can do this:
wp_update_user([
'ID' => $userId, // this is the ID of the user you want to update.
'first_name' => $firstName,
'last_name' => $lastName,
]);
You can update / insert almost all fields with this function. Take a look at the documentation here