First of all being the "founder" of a startup in no way implies that one wrote all the code of the startup's primary or signature app. The founder could have hires coders, or had partners, or used open source code.
But let's make some assumptions. Suppose Alice has created a startup, and wrote the code for an application. Suppose Bob invested in the startup, and got 30% of the stock, What rights does Bob have to the copyright on the code?
It depends entirely on what agreements Alice has made.
Alice might have sold or assigned the copyright to her startup firm, call that F1, If so, F1 owns the copyright, and Alice can't reuse it without F1's permission. If Alice has retained the other 70% of F1, she controls it and can have it grant her whatever permissions she likes. But if she has sold or assigned a majority shore to investors, she will need to persuade the management of F1, or a majority of the shareholders, to grant her permission.
Alice might have merely licensed the code to F1. In this case she retains the copyright. If the license was not exclusive, she can use the code as she pleases, but so can F1, in accord with the license.
In neither case does Bob directly own the copyright, or a share in it, unless a separate agreement granted or sold that to him. But he has a right to a share of the profits, if any that F1 makes, and a right to vote on decisions that 1 makes, long with other owners of F1
If Alice never formally transferred or licensed the software to F1, she still owns the copyright and can do as she pleases, even if shew sold most or al of F1
Note that to transfer a copyright there must (under US law) be a written and signed document, one signed by the owner or the owner's agent. It must specifically indicate what copyright(S) it transfers. A purchase of an interest in a business does not suffice without such a document.