But "the line of succession" is not an official entity separate from the monarchy. It is simply an term of description for the set of individuals who are legally eligible to be monarch. And the laws governing eligibility to be monarch make no distinction between those who have a higher probability of becoming monarch and those who have a lower probability.
What Moonmaiden23's question means in practice is: Suppose all of the descendants of Charles III with the exception of Lilibet were to unexpectedly die, followed quickly by the death of Charles III himself, and Lilibet remained unbaptized up to the moment of Charles III's death. Would Lilibet or Andrew be the legal monarch? By law, the next sovereign succeeds immediately upon the death of the previous monarch, so one of them would be monarch in the eyes of the law, even if it was not immediately clear who it was.
Again, the statutory provisions are as follows, and it is clear that Lilibet would need to fulfill the Church of England's requirements for being "Protestant", at minimum:
Bill of Rights 1688
[...] And the said Crowne and Government shall from time to time descend to and be enjoyed by such person or persons being Protestants [...]
Act of Settlement 1700
[...] and for Default of Issue of the said Princess Ann and of His Majesty [King William III] respectively the Crown and Regall Government [...] shall be remain and continue to the said most Excellent Princess Sophia and the Heirs of Her Body being Protestants [...]
That whosoever shall hereafter come to the possession of this crown shall joyn in communion with the Church of England as by law established [...]
A
House of Commons briefing paper explains that the last clause actually debars even some Protestant denominations:
At first the effect of this was to exclude all members of other churches. However, members of certain other Protestant churches may not now be debarred. Since 1972, by the Church of England’s Admission to Holy Communion Measure18, and the [Church of England] Canon (B15A) that followed it, “baptised persons who are communicant members of other churches which subscribe to the doctrine of the Holy Trinity, and who are in good standing in their own Church” shall without further process be admitted to Holy Communion in Church of England churches.
This means, for instance, that a Methodist, Congregationalist, Church of Scotland, or Baptist member can take Anglican Communion, though a Unitarian (who would reject the concept of the Trinity) and Quakers (who do not subscribe to the concept of the Lord’s Supper) could not. Hence in the strict sense of the wording of the Act of Settlement, members of most Protestant churches would not now be excluded.