Hunting creatures and bandit NPCs. 40 XP per 30 minutes, provided that you make every shot. If you kill your target or they move locations, factor in traveling to line up distance for each combat round.
You can also gain XP between hunting cool downs from applying medical items to yourself, which has the added bonus of healing you up and allowing you to keep hunting. Combat (hunting) is easily the fastest way to get XP if you are active.
I always hunted in a Sprint so on cross terrain I could heal and get the additional xp for being in a medical entity (as your med items do bonus healing and xp gain is half of health gained). It all adds up.
I recommend buying K-4 droids. About 40? And cover two undeveloped terrain squares. The droids are easy to repackage so they only take up storage space instead of Passenger space.
You can see everything as soon as you enter a square and can tell if you need to fly to the 2nd square if nobody is home. Just bounce between those two and it'll force spawns.
Do not use squads. They will get picked off by stuff while you sleep and you will be sad.
If you have high skills (to get into the 7-7.5 attack range listed on the combat page) you won't miss often and can really crank out XP. Especially if you attack with a terrible weapon against a massive creature. It will regen health faster than you can kill it off hopefully so you won't have to waste time transitioning between terrain (find a space slug). The damage you do does not matter. I wish you gained XP based off damage done but that is not the case. If you connect all hits you get 40XP. It does not matter if your weapon fires 1 or 10 shots per volley, the odds are the same in the end based on your dex+weapon skill.
Oh if you attack a big creature it is sure to smash you so you will needs lots of healing and get all of that XP from fixing your massive boo-boos.
Squads and NPCs are not an efficient way to gain XP regardless, as they just damage your target and steal the chance for you to earn more XP from them because they die faster, necessitating you having to waste time crossing terrain more often.
I wouldn't use the k4 droids as they are inaccurate, don't level up, and are easily destroyed. Like what Mikel said hunt alone for mass amounts of XP. Hunting with NPC's offers less XP gain but you offers a chance of more drops and you will level up your NPC's as well. Droids will not level up your NPC's will and only get better and more HP as the level up.
Ideally you want to be able to see the grid the moment you finish cross terraining without needing to unboard so you can decide whether to just cross terrain back to the adjacent square. Otherwise you are wasting a lot of time scanning the square manually.