Whats the best Android phone in 2023 if we only consider hardware?
Galaxy S23 Ultra
As of today, source:
https://www.androidauthority.com/best-android-phones-568001/
what about software?
In 2023 most Android phones use the same operating system, Android OS. Although there are many different versions of the OS, including branded, and OEM versions of the software, typically any phone with the most up to date version of Android OS will have the best software available to it.

As of today the latest version of Android OS is Android 13, and the S23 currently has Android 13.

In terms of features however, most branded androids will each come with their own gimmick in terms of the software.
For example, Motorola phones has gesture features where you can make motions with the phone in your hand for it to do something, like turn on the flash light.
Sony phones tend to have better camera software, as well as additional software features baked in. In the Xperia I IV for example, it has a gaming mode, that allows you to change how power is delivered to the phone to overclock it.
Samsung phones typically have the newest innovations in terms of software and hardware features. The newer S series, including the S23 now have the stylus built in, removing the need for Samsung's note series. 

Ultimately, the best version of Android OS is up to your preference, depending on what features each brand incorporates into the phone.