Sometimes its for everyone (server side lag) and sometimes its just your machine (client side lag).
You cant fix server side lag but usually its ironed out pretty quick. Its cause can be a hundred different things.
However if its client side lag, you can do a lot. For instance sometimes a wired instead of wireless connection can be quicker and more stable. Shutting down all but my minecraft on your PC can also help. With wifi you can engage in practices that make it better. If your in a multi person household and one person is watching Netflix on wifi and another Youtube on wifi, then you play minecraft the wifi will start to choke on its own feed. It just cant handle it. Try to play when less people are doing things that take up a lot of wifi.
You can always do /ping in chat. I think numbers over 300 are bad.
I hope your issue can be resolved and your game play can improve.