I have found that when transferring video (.MOV) files from my iPhone to my PC, if the MOV file has been edited (and was not saved as a new clip or permanent version of the file), then Windows Explorer will throw the error "Error Copying File or Folder > A device attached to the system is not functioning.". There seems to be a problem with copying over an edited (non-permanent) version of the video (.MOV) file. This type of non-permanent edited version of the file likely has some dependency on the original MOV file, since the edited file is what displayed on the device when viewing videos (not the original). This likely means the file cannot be read properly by the PC during the transfer. The non-permanent edited versions of videos also do not seem to be able to be played natively on a PC from the device itself if you are accessing then directly in Windows Explorer. Apple likely has some proprietary software that is able to read the non-permanent edited file using the associated AAE file, so that it can play it on the iOS device. There may be software for PCs that can read these files to play them, but this is not the case with what I have on my PC.
Any photo or video that has been edited can be reverted to the original on the device. For my iPhone (currently iOS 16.1.2) the edited versions of photos or videos has an E preceding the number in the file name (IMG_E6160.MOV). You should notice that the original (unedited) file is also there with the edited version (IMG_6160.MOV) with no 'E' preceding the number, as well as a .AAE file that contains edit metadata (IMG_6160.AAE).
This transfer issue should not occur if you made your edits to the video file permanent. Originally, when I was editing I was not aware of the differences, so I ended up saving my edits without making them permanent. A google search turned various options to make edits to video file permanent on iOS devices using apps like iMovie, but I did not try those.
Initially, my solution was to I work around this by doing a device to device share to copy the edited version of the file to another iOS device. Transferring that file from the other iOS device to the PC worked fine because it created a permanent version of the video (MOV) file on the other device, but the process was was cumbersome. The other option I discovered was to edit the edited video file itself so that I did not lose the time I put into the initial edit. I simply clipped the edited video file by 1/100th of a second to allow me to save the file anew. When I clicked Done on the edit session I was presented with the option to 'Save Video as New Clip' or 'Save Video'. Choosing 'Save Video as New Clip' saved a permanent version of the edited video file. Any edit to the file will give you these options, but you must make some sort of change to have these Save options presented to you. The only caveat to this second option is that a new folder is created to store the new edited clip of the video file (for me it was the same folder name as where the file was originally store with an added "_a" appended to the end of the new folder name. This is still a bit cumbersome because it means more folders to open and copy files from.
It's worth mentioning that I did not have this issue with transferring over edited photos, only edited videos.
You can avoid the majority of your transfer crashes and failures if you do not select the Edited version of Videos when you are transferring files, or if you make your edited copies of the original video files permanent when you save them in the first place. There may be other methods to make edited video files permanent, but I have not researched that.