As a native American English speaker you could use “on accident” or “by accident” pretty synonymously. If I really think about it though I would only really use the two differently where “by accident” was towards the beginning of the sentence and “on accident” was at the end of the sentence “by accident I headshot the guy” and the other way would be “I headshot the guy on accident”