From just looking at the specs, the big differences seem to be the drive unit, display and fork.
Regarding drive system, both have Bosch systems, but different versions. The Trek has a Performance Line unit, while the Haibike has a CX unit. The CX is popular for eMTB because of its higher torque rating and overall performance more tailored to eMTB. The Performance Line unit on the Trek is the lower rated unit of 2 Performance Line models, which supports speeds up to 20 mph ("Cruise"). There is a higher rated unit that supports speeds up to 28 mph ("Speed"). You can see all the specs on the Bosch site
https://www.bosch-ebike.com/us/products/drive-units/
The display unit on the Trek is the Purion, which is a small, compact unit, while the Haibike has the Intuvia, which is larger and removable. Both are fine. For eMTB I definitely like a smaller display - in fact my eMTB has no display (the Turbo Levo). My city bike is a Tern Vektron, with an Intuvia that I really like.
Haibike has a suspension fork, while Trek is rigid. So the ride on the Haibike should be a lot smoother with the shock.
The key components look a little higher end on the Haibike - 11 speed Deore 8000 system vs 10 speed Deore 6000 on the Trek.
That suspension fork would be enough for me to go with the Haibike, just for comfort. All in all, I think the Haibike has an edge.
I'm currently salivating over the SDURO Trekking S 9.0, which has a integrated downtube and speed drive unit. The dream is the yet to be released XDURO Adventr 6.0.
e bike tech is very dynamic and changing rapidly. Wait 6 months, the older bikes get cheaper and the newer bikes cause insatiable desire.