From the UK to Sweden:
Provided that you have a residence permit in the UK, you can travel from the UK to Sweden using your national identification card. Remember to link your national identification card to your pre-settled or settled status (EU Settlement Scheme - EUSS).
From Sweden to the UK:
According to Swedish passport law, you must bring a valid passport when leaving Sweden if you are traveling outside of the EU.
For information about what is required when entering the UK, please contact British authorities.