In many situations the two expressions mean the same thing and can be used interchangeably. However, there is a discernable difference in shades of meaning in some contexts. A difficulty arises because I have heard that what applies to one region may be the opposite of that which applies in another! The following is based on my idiolect, which is fairly standard British English:
By yourself – without any other person accompanying you
On your own – without any help from others
A real life example! If I'm giving a paper at a conference, someone may ask me: "Who else from the company is giving a paper or chairing some of the sessions?" Reply: "I'm there/I'm doing it on my own." i.e. with no help from others.
As I said, there are variations and in most cases either phrase can be used.