Remove all export DISPLAY settings in your startup files!
It's not needed anymore.
With recent WSL (Windows 10 Build 19044+ or Win 11), the system takes care of that.
I repeat.
You do no longer need to export the DISPLAY variable!
Prior to reading the official documentation, linked in MOMO's answer, I had tried all the fancy ways of getting the DISPLAY value automatically set posted by others, and nothing worked.
Backstory
I, and many with me, use non-default name servers, so I can't use that trick to refer to my local system. Instead I have a static value for IPv6 localhost in /etc/hosts.
# This is to always have a named host address for servers on WSL, like sshd
# Usually I use 127.0.0.1 instead.
::1 wsl
And the same in Windows c:\Windows\System32\drivers\etc\hosts
Then I had set the DISPLAY variable in ~/.bashrc like this.
export DISPLAY=wsl:0.0
When testing both thunderbird and mousepad start fine.
But if I tried to start firefox/firefox-esr I got failed access to DISPLAY.
$ firefox-esr
Error: cannot open display: wsl:0.0
Basically, thunderbird never cared what DISPLAY was set to. Perhaps that is why it worked for me. It started even back when the variable was set to the wrong IP.
But, now, with no DISPLAY variable manually set, firefox works great!
Information about my Windows 10 system.
$ uname -a
Linux pappa 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 \
UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
> wsl --version
WSL-version: 1.0.3.0
Kernelversion: 5.15.79.1
WSLg-version: 1.0.47
MSRDC-version: 1.2.3575
Direct3D-version: 1.606.4
DXCore-version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows: 10.0.19045.2364
> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
Debian Stopped 2
NVIDIA Geforce GTX 1070, driver 527.56
Apps that I tested.
$ thunderbird --version
Thunderbird 102.6.1
$ mousepad --version
Mousepad 0.5.8
$ firefox --version
Mozilla Firefox 108.0.1
$ firefox-esr --version
Mozilla Firefox 102.6.0esr
Even something heavy like GIMP runs fine.
$ gimp --version
GNU Image Manipulation Program version 2.10.30
And finally...
$ set | grep DISPLAY
DISPLAY=:0
WAYLAND_DISPLAY=wayland-0
wsl --update
. Then you can directly run GUI apps.