Latency is the measure of time it takes for data to travel from one point to another, and back. Latency is essentially a delay between when you take an action and when you see the result. Of course, the lower latency the better.
On the picture below, latency is 80 milliseconds (45 ms for data to travel from your computer to a central server, and 35 ms to travel back to your computer):
Ping is actually a software utility used to test connection between computer networks. Yet, when it comes to online gaming, ping and latency are usually considered synonymous.
What is a good ping / latency
A good figure for latency is relative. Ping is something that is specific to the server you are connecting to. If you're playing an online game that's hosted on a server in Belgium, then the ping should be pretty low. However, if that server is located on the other side of the world or if for some reason your signal isn't taking the most direct route to it, then the ping is likely to be much higher, up to hundreds of milliseconds.
It also depends on what you are doing online. While good ping may be vital for a good online gaming experience, it doesn't matter as much when it comes to using streaming services. On the other hand, when broadcasting the stream, it can cause a delay between when what actually happens and when your viewers see it. Generally speaking, the ping lower than 50ms is really good. More than 150ms is where you are may start having problems with games, and probably other services, too.
How can I check my ping / latency
You can check latency of your internet connection by using the same speed test tools that you would use to verify downstream and upstream bandwidth (try https://speedtest.edpnet.net/ or https://speedtest.telenet.be/):
Almost of all of online games have the option to check your ping directly in game.
If you would like to make a ping test to a specific server, you can do so from Command Prompt (if you're using Windows) or Terminal (if you're using macOS).