If only the white and black balls remains, and I hit the black one and it’s get in pocket first.. and then the white one goes out the table I consider myself won or lost
Assuming you're talking about 8-ball, in almost all variations this is considered a foul (for sending the cue ball off of the table) and if you foul while simultaneously sinking the 8, it is considered a loss regardless of all other circumstances.
See APA rules 4.c. and 9.a. respectively - https://poolplayers.com/8-9-ball-Rules.pdf
Or UPA rules section 4.2 - https://upatour.com/official-billiard-rules/u-s-8-ball-rules/