If you find out, you’re supposed to feel guilty* and be more careful the next time.
You can also eat non-kosher food if there’s truly no other choice – say, you’re marooned on a desert island with nothing but cans of spam. You aren’t to make yourself sick.
*Seriously.
It’s not considered a sin because it was inadvertent. However, IIRC some ritual impurity does accrue. But, everybody who has ever been to a graveyard is ritually impure too. We all need to be sprinkled with the ashes of a perfect red heifer. Such an animal no longer exists.
And, for that matter, the temple where that heifer is supposed to be sacrificed doesn’t exist any more, either. Which is just as well, since the biggest consequence of uncleansed ritual impurity is that you’re not allowed to do a bunch of temple activities.
And one of those temple activities is bringing a sin offering when you inadvertently violate certain commandments, including some of the rules of kashrut.