I'm wanting to make a sorcerer that throws a little flare in his spell attacks. I was wondering if I could use a range spell attack as a melee attack. Like casting firebolt, but punching with it instead of throwing it.
There is no such general option, but you're not fully out of luck
There's no general rule which lets you make turn a ranged attack into a melee attack. On the contrary, trying to use a ranged attack in melee will give disadvantage (PHB 195).
Since you are wanting this for a character concept, you don't need a rule for turning ranged attacks into melee attacks, you need a cantrip which fits what you want for the concept.
Unfortunatly, there are no cantrips which directly fit your bill, so you should work with your DM to figure something out. Fortunately, the design pattern of cantrips is fairly tight so it should be easy to cobble something together.
Specifically, you could have the cantrip — let's call it flare — be a mod of firebolt except with a melee spell attack. As most squishy sorcerers would like to not be in melee range, this doesn't generally make it stronger than firebolt. Another approach is to use start with the Druid cantrip primal savagery (XGtE) and change the acid damage to fire damage (and change the descriptive text to be less about teeth and fingernails. These two versions of flare are basically identical (components, school, etc. are left to the reader or their DM), which is good, because that suggests we are readily staying within bounds (ie. balance).
There is no general rule preventing close-range use of ranged attacks
While you cannot just redesignate a ranged attack as a melee attack, there is no general rule preventing you from using those attacks at close range, i.e. melee range.
Disadvantage at close range can be negated
Generally, close-range use of ranged attacks imposes disadvantage. This can be negated using the crossbow expert feat which does work for non-crossbows, see this question: Crossbow Expert Feat... for Spells?
Removing the restriction without the feat is a problem
Taking a feat is an investment. Giving the same benefits out for free is a problem since it changes combat balance and devalues the feat. You could talk to your GM, however, and ask if this benefit can be taken instead of some race or class feature. Discussing this in detail would be beyond the scope of this answer. Restricting the benefit to just firebolt would be a pretty minor feature, however.
Sort of, but with disadvantage
Attacks are designated as melee or ranged, and you’re unable to choose to make a ranged attack into a melee one. You can make a ranged attack at point blank range, but you’re still governed by the general rules of ranged attacks, as found in Chapter 9 of the PHB and Basic Rules under “Ranged Attacks in Close Combat” (emphasis mine):
Aiming a ranged attack is more difficult when a foe is next to you. When you make a ranged attack with a weapon, a spell, or some other means, you have disadvantage on the attack roll if you are within 5 feet of a hostile creature who can see you and who isn't incapacitated.
So you can make that fire bolt attack close up, but it’s still a ranged attack, and so will be made at disadvantage.