According to Article 7 of the Law of Ukraine "On Freedom of Movement and Free Choice of Place of Residence in Ukraine", grounds for removing a person's place of residence from registration are:
application of such a person (voluntary eviction);
a court decision that has entered into legal force, on the deprivation of the right to own a residential premises or the right to use a residential premises, on eviction, on the recognition of a person as missing or declared dead, a death certificate, a passport received from the state registration body of acts of civil status , or a death certificate issued by a competent authority of a foreign state, legalized in accordance with the established procedure.
If the house was bought at the expense of mortgage lending, then during the martial law, it cannot be taken away, in other cases, each situation must be analyzed separately, since there are many circumstances that can make this impossible, and vice versa.