Assuming you are found to be UK resident for 2018/19, you will need to consider the split tax year rules (cases 1 to 3 for leavers). The split tax year rules potentially allow a tax year to be split into a UK part where you are taxed as a resident and an overseas part where you are taxed as a non-UK resident (perhaps escaping UK tax on your self employment income if all of your work is performed outside the UK).
A condition for claiming split tax year treatment is that you are non-UK resident in the following tax year (year ending 5 April 2020 in your situation) and so what you plan to do in the current UK tax year will be very important. Ideally, your self employment overseas should continue until at least 5 April 2020 (or very close to that date).
If you qualify for split year treatment in 2018/19 and are non-UK resident for 2019/20 (this will have to be under the 3rd automatic overseas test if case 1 split tax year treatment is claimed) there are special provisions that apply for the self employed (see extract below from RDR3):
Self-employment – business commencement and cessation provisions
4.7 As a non-UK resident you will pay tax on profits:
from a trade, profession or vocation (business) you carry on in the UK
from the UK part of a business carried on partly in the UK and partly elsewhere
4.8 There are special rules which apply when you start or end your business (‘commencement’ and ‘cessation’ rules). These rules may apply when you cease to be resident in the UK even though you’ve not started or ended your business. The commencement and cessation rules will apply if you:
have been carrying on a business
cease being resident in the UK
And you continue to carry on that business. You’re ‘deemed’ to have ceased one business and started another from the date of the change in your UK residence status or, if split year treatment applies, from the split year date.
4.9 Unless split year treatment applies, the cessation of your residence in the UK takes place at the end of the last tax year of UK residence. Your business is deemed to have ceased and a new business to have commenced at that time. This may affect the amount of tax you’ve to pay.
4.10 Where the ‘deemed’ cessation of one business and commencement of another applies, for UK tax purposes any unused losses in the UK business, or in the UK part of the business, before the change in your UK residence status can be carried forward and set against the profits of the ‘deemed’ commencing business that arise in the UK.
4.11 Most trades and professions are carried out in a particular location such as a shop or factory. Therefore, ceasing to be UK resident usually means the location of the business changes (for example from one country to another). The fact that the business is in a completely new location is likely to mean that it has:
a different structure
a different customer base
And that the business has in fact ceased and a new business has commenced. In these circumstances you will not be able to carry forward losses from the old business to set against profits of the new one.
4.12 Some businesses are not carried out from a single location in this way. These businesses are mainly carried on by professional people, wherever in the world the person happens to be. Examples of this would include:
sportsmen or women
Effect of split year treatment when you carry on a trade, profession or vocation
4.13 If split year treatment applies to you, the deemed cessation and commencement takes place at the end of the UK part of the year. For the year of leaving the UK, you will be liable to UK tax on:
the proportion of your profits which reflect the profits you made in the UK part of the tax year
the profits from a UK trade, or profits from the part of the trade carried on in the UK, during the overseas part of the tax year - if the deeming rule in paragraph 4.9 apply, any unused losses in the UK trade or the UK part of the trade before the deemed cessation can be carried forward and used against profit of the deemed commencing business.
PS if you are performing all of your work for one UK company, it may be advisable to review the employed/self employed rules to see whether HMRC might contend you are really employed rather than self employed.