are proxy servers used for security purposes? do they have other functions?
Yes, very much so.
They are also very commonly used to allow a single IP address to be used for many services. The most common example... a single proxy server with a single (expensive) public IP address can handle requests for hundreds of thousands, or even millions, of websites. Behind the proxy server can be one or one million separate web servers each serving out applications or web sites or whatever and the proxy server can look at the incoming request and determine, based on the URL used, which server and port to send the request to behind itself.
Because of the above, they are often used for load balancing because they can send requests to different servers for the same application or site.
Proxy servers often have caches in them, too. So they quite often store simple, static information "at the edge" to deliver it faster while the application servers behind them do the heavy work for database requests and stuff.
Proxy servers are sometimes used to "hide" the true location of a server. Cloudflare famously does this so that attackers have no idea where a web site actually comes from, all they see is Cloudflare's proxies.
A proxy can also do things like handle SSL security so that web servers behind it (or other servers, proxy doesn't imply web) don't have to do that work, as well.
Hrm, I only have around 20 subdomains pointing to the same IP so far. If my home lab box was a little beefier I'd take this as a challenge. (Scott might as well be describing my home lab environment here.)