Seeing it on your PC
TeamViewer connecting out to its servers on 5938.
Should you block it?
If you did not install TeamViewer, or do not use it, remove it: scammers ask victims to install it. If you use it, protect it with two-factor sign-in.
Check it on your PC
Run this in PowerShell to see what is using port 5938 right now, and which program owns it:
Get-NetTCPConnection -LocalPort 5938 -ErrorAction SilentlyContinue | Select-Object LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{n='Process';e={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).ProcessName}}Get-NetUDPEndpoint -LocalPort 5938 -ErrorAction SilentlyContinue | Select-Object LocalAddress,LocalPort,@{n='Process';e={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).ProcessName}}No output means nothing is using the port at the moment. For every connection at once, paste netstat -ano into the netstat explainer.
Block it in Windows Firewall
In PowerShell run as administrator, this stops other computers from connecting to this port on your PC. It does not stop your own programs connecting out.
New-NetFirewallRule -DisplayName "Block inbound TCP 5938" -Direction Inbound -Protocol TCP -LocalPort 5938 -Action Block
New-NetFirewallRule -DisplayName "Block inbound UDP 5938" -Direction Inbound -Protocol UDP -LocalPort 5938 -Action Block
Undo it with Remove-NetFirewallRule -DisplayName "Block inbound …", using the same name. If you depend on the service on your local network, this rule stops that too.