This is a question of philosophy of science.
Some philosophers have held that generic principles, such as conservation laws, are more conventional than really true (neither true or false e.g. Wittgenstein viewed the principle of causality and perhaps all scientific laws as a 'fishnet' for apprehending reality. Something that does not follow the principle of causality, he assumed, is not thinkable which does not entail that this principle belongs to the world itself) Poincaré also held conventionalist thesis.
The difference between logical and physical necessity is often casted in terms of an "analytic / synthetic" distinction, which terms goes back to Kant. Something is analytic if :
- its contradiction is absurd
- it is true in virtue of its meaning only (e.g. bachelors are unmarried)
These definitions are taken to be equivalent. Another view would be that analytic truth are logically necessary.
Something analytic can be thought of as a mere linguistic convention, or a tautology. Something is synthetic if it can be either true or false, depending on the world.
Kant thought that logical truth (the excluded middle) are analytic but not mathematical truth because, say, denying the 5th axiom of euclid geometry is not absurd. Mathematical truth are known by intuition.
Later, Wittgenstein and logical empiricists conceived of all logical, mathematical and conceptual (red is a colour) truth as analytic and all scientific truth as synthetic.
For them analytic equals necessary (but an analytic truth is purely tautological, it results from a convention) and synthetic equals contingent.
The analytic synthetic distinction was later criticised by Quine in 'two dogmas of empiricism', where he argued that because of confirmation holism (we always make more than one assumption when testing an hypotheses) the linguistic and factual components can never be clearly distinguished. Even mathematical and logical principles are put to test when verifying an assumption, although revising a logical principle when a test fails would be an extreme option (but he noted some have proposed to replace classical logic with intuitionist logic to solve some dilemma in quantum mechanics).
If Quine's arguments are sounds, there is some continuum between what is true in virtue of linguistic conventions (logic, generic scientific principles maybe) and what is true in virtue of the world (direct observations) with scientific laws in the middle. We can be pragmatic and assume that developing science and knowledge more generally amounts to picking the conventions which work well in interacting with the world.
EDIT: I'd like to develop a bit.
The main point, in my view, is that the more something is necessary (its negation is impossible) the more it can be interpreted as a definition.
The law of excluded middle (a is true or not-a is true) can be viewed as a profound principle, but it can also be interpreted as merely spelling out, together with other principles, what we mean by "not", "or" and "true". Some logicians have argued that intuitionist logic is not a revision of logic, but a change in definitions (with "provably true" replacing "true").
Similarly the cosmological principle can be interpreted as a profound principle on the nature of the world, but also as a mere definition of what we mean by "physical law" and if it turned out to be false there would certainly be a physicist to argue that what we discovered is simply that what we thought were physical laws were actually contingent facts, which are only valid in some parts of the universe, but that the principle is still true.
The same goes for the conservation of energy: it can be interpreted as a definition of energy as some quantity which is conserved over time.
What would really undermine these principles is if we discover that, e.g. there cannot be any physical law at all (maybe in virtue of another principle) but that would probably undermine the whole scientific endeavour as it is known today.
On the contrary, if you assume that all swans are white, then see a black swan, it is possible to say "well actually that's not a swan, since all swans are white.", that is, you can insist for white to be part of the definition of swan. But this is clearly not the more clever move. Which shows that swans are not necessarily white.
In conclusion, the question of whether something is more or less impossible/necessary amounts to a question of pragmatic: how much does it cost to change a definition or a feature attached to a concept? In the case of white swans, not much. In the case of a generic physical principle, a lot. In the case of logic or mathematics, it is not even clear we could still think properly about anything if we changed it.