A Target In Range is not the same as a Creature In An Area Of Effect
Whether or not you are within X feet of yourself depends on whether you are choosing a target for a spell, or determining if a creature is affected by the area of effect of a spell (or similar).
Target In Range
Targets (PHB 204)
A typical spell requires you to pick one or more targets to be
affected by the spell's magic.
Targeting Yourself (PHB 204 -- continuing the above section)
If a spell targets a creature of your choice, you can choose yourself,
unless the creature must be hostile or specifically a creature other
than you. If you are in the area of effect of a spell you cast, you
can target yourself.
This is the source of why "you are always within 30 feet of yourself" when casting Bless.
When a spell lists a range in its description, it is referring to where you can target a spell, and the caster is included in that range.
Creature In An Area Of Effect
Areas of Effect (PHB 204-205)
Spells ... cover an area, allowing them to affect multiple creatures
at once. A spell's description typically has one of five different
shapes: cone, cube, cylinder, line, or sphere. Every area of effect
has a point of origin, a location from which the spell's energy
A cone/cube/line's point of origin is not include in the
cone/cube/line's area of effect, unless you decide otherwise.
A cylinder/sphere's point of origin is included in the
cylinder/sphere's area of effect.
So, sometimes the area of effect includes the creature at the point of origin, sometimes it doesn't. In many (but not all) cases, the caster gets to decide.
DM adjudicates ambiguous cases
Sometimes a spell doesn't say the shape, it just says "within X feet".
In those cases, it appears to be consistent that, unless it says otherwise, the target is not included.
However, just a vague "within X feet" would imply to me to indicate a sphere, which means a target is included.
I could find no explicit rules on which to follow, so ultimately it is up to the DM to decide, based on what makes sense for their table.
I personally follow the convention of not including the target of an effect when the words "within X feet" are used without a shape, as it generally results in the least absurd or ridiculous result (like having a Wild Magic Sorcerer immediately be healed for the damage they just took.)
Sword burst has a range of 5 feet, and the description states that all the creatures in range are targeted. Normally, this would include the caster, which is why it explicitly states the caster is not included in the description. Note that this is NOT an area of effect, so those rules don't apply. This just falls under the normal Targets rules.
Bless has a range of 30 feet. Under the Targets rules you are included in that range, so you can target yourself.
Ice Knife has a range of 60 feet, and a spherical area of effect of 5 feet. As the target is at the point of origin, and a sphere's point of origin is included in the area effect, the description is simply restating the normal rules for who is included in the damage. The OP says this implies that the target is not normally included, but I think this wording was used simply to help make it clear that the target is affected as well, for those that don't have the area of effect rules memorized.
For this spell, the range is self -- meaning the caster gets to enhance their ranged attacks, not that they are attacking themselves.
There is no area of effect for this spell, but rather the damage description is customized... and vague. This is where I wish the rules provided explicit guidance on when then is an area of effect that doesn't specify a shape.
The Wild Magic Surge examples in the OP also fall into this category of vagueness, but in each of these cases I would rule that the caster/target is not included in the resulting effect.