If the Xauthority file is located at $HOME/.Xauthority, then you are not supposed to need the XAUTHORITY environment variable, since $HOME/.Xauthority is the default path: the X11 libraries should be checking it automatically.
If you then use sudo to switch to root, then it becomes more difficult to maintain the X11 session access through sudo, as it's no longer just a matter of preserving the DISPLAY and XAUTHORITY environment variables and letting the root user read the Xauthority from wherever it is: a suitable XAUTHORITY value will need to be set at some point to identify the actual location of the Xauthority file. It's not really important how it gets set, as long as it gets set before the process that will need it is started.
If sudo is already configured to preserve the XAUTHORITY variable, then you could work around this by explicitly setting XAUTHORITY in your login script (as your original user account before sudo) if DISPLAY is set, with something like this:
if [ "$DISPLAY" != "" ] && [ "$XAUTHORITY" = "" ]; then
export XAUTHORITY=$HOME/.Xauthority
fi
Alternatively, if sudo does not preserve XAUTHORITY and/or you do not wish to configure sudo to preserve it, you could put the following snippet into the /etc/bash.bashrc or ~/.bashrc (or whatever script gets executed by the shell started by the sudo command).
if [ "$SUDO_USER" != "" ] && [ "$DISPLAY" != "" ]; then
export XAUTHORITY=$(getent passwd "${SUDO_USER}" | cut -d : -f 6)/.Xauthority
fi