Generally if you are a UK resident, you must declare your worldwide income on a Self Assessment tax return form. Unless you do not remit the income to the UK and the income remains in the other country.
If you remain non UK resident, you may not be required to declare your earnings from abroad.
You can find the Statutory Residence Test (SRT) to determine your tax status here:
RDR3: Statutory Residence Test (SRT) notes
You can find guidance on reporting income from abroad if UK resident for tax here:
Tax on foreign income