HMRC cannot give financial planning advice, however, you can be resident in the UK and still work for a non UK company. The income would need to be declared to the UK and taxes paid here. If the non UK company deduct tax at source, HMRC can look at giving credit for this.
You would need to register for Self Assesssment. Please see guidance here on foreign income.
Tax on foreign income