Assuming you want PC versions, you can buy used copies of these games from an online store, but they would only be good for offline (or LAN) play. EA's online severs for NFS UG, UG2, MW were shut down long ago, so this only affects NFS Carbon, since its servers are still running.
Some or all of the games in your list have a LAN mode, and with a virtual LAN (like a VPN - virtual private network), can be used to play with other players on the internet, but all of those players would need to be on the same virtual LAN. If you just play to play with friends, you could set this up yourself, but it may require a second computer. There are/were groups that emulated online play by "hosting" virtual LANs that players could join.
The older still titles like NFS High Stakes (1999) and Porsche Unleashed (2000) have a TCP-IP mode, where you only need the ip addresses of the other players to play with a group. There is at least one site that hosts "rooms" for TCP-IP to make this easier.
As for more recent games, Undercover is the first NFS to require online activation, but you can still find new DVD copies of Undercover at online stores. I recommend getting the retail DVD version (the DVD is only used for install), as it is compatible with patch 1.0.1.18, which adds the challenge series, which rewards 3 special tier 1 cars. I'm not aware of an equivalent patch for the Origin download version of Undercover.