Note that this verse is a part of Surah Ahqaf which is Makki. So, this verse was revealed long before many of the later verses of the Quran.
In this verse, Allah tells the Prophet (SAW) to say:
nor do I know what will be done with me or with you (46:9)
What is it about? Two opinions: Either it refers to the Day of Judgement or it refers to this world.
First opinion: Day of Judgement
The Prophet (SAW) is told to say he does not know what will happen to him and the believers on the Day of Judgement. Will they go to Jannah or Jahannam?
As mentioned before, this verse was revealed in Makkah. We know there are many verses that clearly promise the Prophet (SAW) and the believers Paradise that were revealed in Madinah.
So, it is possible this is simply that the Prophet (SAW) was not told his fate at that point, but was told later on.
This is the understanding of the verse quoted from Ibn Abbas (RA) as mentioned by Imam Tabari.
Ibn Abbas said about Allah's statement ⟪nor do I know what will be done with me or with you⟫: then Allah revealed after it ⟪That Allah may forgive for you what preceded of your sin and what will follow⟫ (48:2)
We know plenty of ahadith from the Prophet that he knew he would go to Paradise and a lot of the events that happen on the Day of Judgement, but most if not all of them are from Madinah. We also know countless verses (which I will not quote for fear of lengthening the answer) that are pretty clear that there is no doubt the Prophet will go to Jannah. So, this verse was revealed before them, and that is how it can be understood.
Second opinion: This World
The Prophet (SAW) is told to say he does not know the future of what will happen in this world between him and the disbelievers regarding the oppression, wars, etc. or whether Islam will be oppressed or successful.
In this view, there's no issue. The Prophet (SAW) does not always know the future except when Allah informs him either in the Quran or outside the Quran.
However, this also must be qualified. Later on in the Quran, Allah tells the Prophet (SAW) things of the future about him like the fact that he will be protected:
O Messenger, announce that which has been revealed to you from your Lord, and if you do not, then you have not conveyed His message. And Allah will protect you from the people. Indeed, Allah does not guide the disbelieving people. (5:67)
Allah also informs him later on that Islam will in fact be successful and overcome the disbelievers:
It is He who has sent His Messenger with guidance and the religion of truth to manifest it over all religion, although they who associate others with Allah dislike it.
Be not deceived by the [uninhibited] movement of the disbelievers throughout the land. [It is but] a small enjoyment; then their [final] refuge is Hell, and wretched is the resting place. (3:196-197)
This is not to mention the numerous prophecies of the future the Prophet (SAW) made as mentioned in the ahadith. So, even regarding the worldly life, this is qualified and restricted. The Prophet (SAW) may have not been told at the time this verse was revealed, but he was told later on.
I also suggest you see this article written on the subject that goes into much detail: Did Prophet Muhammad (peace be upon him) Have Assurance of His Own Salvation?